From c718251e32d383a75fb728d065fe3cc6bee4123d Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 14:34:51 -0400 Subject: [PATCH 01/17] fix protocol conflicts --- programs/bubblegum/program/src/error.rs | 8 + programs/bubblegum/program/src/lib.rs | 206 ++++++++++++++++++++++++ 2 files changed, 214 insertions(+) diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index 416e1e21..1522a02d 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -72,6 +72,14 @@ pub enum BubblegumError { UnknownExternalError, #[msg("Decompression is disabled for this tree.")] DecompressionDisabled, + #[msg("Metadata Not Mutable")] + MetadataImmutable, + #[msg("Collection mismatch")] + CollectionMismatch, + #[msg("MetadataArgs Ambiguous")] + MetadataArgsAmbiguous, + #[msg("MetadataArgs Missing")] + MetadataArgsMissing, } // Converts certain Token Metadata errors into Bubblegum equivalents diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 66a1a857..36b57e8a 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -251,6 +251,39 @@ pub struct Delegate<'info> { pub system_program: Program<'info, System>, } +#[derive(Accounts)] +pub struct UpdateMetadata<'info> { + /// CHECK: Can optionally specify the old_metadata of the leaf through an account to save transaction space + /// CHECK: This account is checked in the instruction + pub old_metadata: Option>, + #[account( + seeds = [merkle_tree.key().as_ref()], + bump, + )] + /// CHECK: This account is neither written to nor read from. + pub tree_authority: Account<'info, TreeConfig>, + pub tree_delegate: Signer<'info>, + /// CHECK: This account is checked in the instruction + pub collection_authority: UncheckedAccount<'info>, + /// CHECK: This account is checked in the instruction + pub collection_mint: UncheckedAccount<'info>, + pub collection_metadata: Box>, + /// CHECK: This account is checked in the instruction + pub collection_authority_record_pda: UncheckedAccount<'info>, + /// CHECK: This account is checked in the instruction + pub leaf_owner: UncheckedAccount<'info>, + /// CHECK: This account is chekced in the instruction + pub leaf_delegate: UncheckedAccount<'info>, + pub payer: Signer<'info>, + #[account(mut)] + /// CHECK: This account is modified in the downstream program + pub merkle_tree: UncheckedAccount<'info>, + pub log_wrapper: Program<'info, Noop>, + pub compression_program: Program<'info, SplAccountCompression>, + pub token_metadata_program: Program<'info, MplTokenMetadata>, + pub system_program: Program<'info, System>, +} + #[derive(Accounts)] #[instruction( _root: [u8; 32], @@ -475,6 +508,7 @@ pub enum InstructionName { SetAndVerifyCollection, MintToCollectionV1, SetDecompressableState, + UpdateMetadata, } pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { @@ -500,6 +534,7 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { [250, 251, 42, 106, 41, 137, 186, 168] => InstructionName::UnverifyCollection, [235, 242, 121, 216, 158, 234, 180, 234] => InstructionName::SetAndVerifyCollection, [37, 232, 198, 199, 64, 102, 128, 49] => InstructionName::SetDecompressableState, + [170, 182, 43, 239, 97, 78, 225, 186] => InstructionName::UpdateMetadata, _ => InstructionName::Unknown, } @@ -681,6 +716,41 @@ fn process_creator_verification<'info>( ) } +// TODO sorend: simplify with the function below +fn assert_signed_by_collection_authority<'info>( + collection_metadata: &Account<'info, TokenMetadata>, + collection_mint: &AccountInfo<'info>, + collection_authority: &AccountInfo<'info>, + collection_authority_record_pda: &AccountInfo<'info>, + token_metadata_program: &AccountInfo<'info>, +) -> Result<()> { + // See if a collection authority record PDA was provided. + let collection_authority_record = if collection_authority_record_pda.key() == crate::id() { + None + } else { + Some(collection_authority_record_pda) + }; + + // Verify correct account ownerships. + require!( + *collection_metadata.to_account_info().owner == token_metadata_program.key(), + BubblegumError::IncorrectOwner + ); + require!( + *collection_mint.owner == spl_token::id(), + BubblegumError::IncorrectOwner + ); + + // Collection authority assert from token-metadata. + assert_has_collection_authority( + collection_authority, + collection_metadata, + collection_mint.key, + collection_authority_record, + )?; + Ok(()) +} + fn process_collection_verification_mpl_only<'info>( collection_metadata: &Account<'info, TokenMetadata>, collection_mint: &AccountInfo<'info>, @@ -1348,6 +1418,142 @@ pub mod bubblegum { ) } + pub fn update_metadata<'info>( + ctx: Context<'_, '_, '_, 'info, UpdateMetadata<'info>>, + root: [u8; 32], + old_metadata: Option, + new_name: Option, + new_symbol: Option, + new_uri: Option, + new_seller_fee_basis_points: Option, + new_primary_sale_happened: Option, + new_is_mutable: Option, + nonce: u64, + index: u32, + ) -> Result<()> { + let merkle_tree = ctx.accounts.merkle_tree.to_account_info(); + let owner = ctx.accounts.leaf_owner.to_account_info(); + let delegate = ctx.accounts.leaf_delegate.to_account_info(); + let incoming_tree_delegate = ctx.accounts.tree_delegate.key(); + let authority = &mut ctx.accounts.tree_authority; + let tree_creator = authority.tree_creator; + let tree_delegate = authority.tree_delegate; + if !authority.is_public { + require!( + incoming_tree_delegate == tree_creator || incoming_tree_delegate == tree_delegate, + BubblegumError::TreeAuthorityIncorrect, + ); + } + + let old_metadata = match old_metadata { + Some(metadata) => { + require!(ctx.accounts.old_metadata.is_none(), BubblegumError::MetadataArgsAmbiguous); + metadata + } + None => { + require!(ctx.accounts.old_metadata.is_some(), BubblegumError::MetadataArgsMissing); + let old_metadata_account = ctx.accounts.old_metadata.as_ref().unwrap(); + let old_metadata_data = old_metadata_account.try_borrow_mut_data()?; + let mut old_metadata_data_slice = old_metadata_data.as_ref(); + MetadataArgs::deserialize(&mut old_metadata_data_slice)? + } + }; + + // Old metadata must be mutable to allow metadata update + require!(old_metadata.is_mutable, BubblegumError::MetadataImmutable); + + // If the NFT is a verified part of a collection, then ensure a collection authority + // has signed the tx to confirm the metadata update. + if let Some(collection) = &old_metadata.collection { + if collection.verified { + // Verified collection must match Collection account + require!( + ctx.accounts.collection_mint.key() == collection.key, + BubblegumError::CollectionMismatch + ); + let collection_metadata = &ctx.accounts.collection_metadata; + let collection_mint = ctx.accounts.collection_mint.to_account_info(); + let collection_authority = ctx.accounts.collection_authority.to_account_info(); + let collection_authority_record_pda = ctx + .accounts + .collection_authority_record_pda + .to_account_info(); + let token_metadata_program = ctx.accounts.token_metadata_program.to_account_info(); + assert_signed_by_collection_authority( + collection_metadata, + &collection_mint, + &collection_authority, + &collection_authority_record_pda, + &token_metadata_program, + )?; + } + } + + let old_data_hash = hash_metadata(&old_metadata)?; + let creator_hash = hash_creators(&old_metadata.creators)?; + + // Update metadata + let mut new_metadata = old_metadata; + if let Some(name) = new_name { + new_metadata.name = name; + }; + if let Some(symbol) = new_symbol { + new_metadata.symbol = symbol; + }; + if let Some(uri) = new_uri { + new_metadata.uri = uri; + }; + if let Some(seller_fee_basis_points) = new_seller_fee_basis_points { + new_metadata.seller_fee_basis_points = seller_fee_basis_points + }; + if let Some(primary_sale_happened) = new_primary_sale_happened { + if !new_metadata.primary_sale_happened { + new_metadata.primary_sale_happened = primary_sale_happened + } + }; + if let Some(is_mutable) = new_is_mutable { + new_metadata.is_mutable = is_mutable; + }; + + // ensure new metadata is mpl_compatible + assert_metadata_is_mpl_compatible(&new_metadata)?; + let new_data_hash = hash_metadata(&new_metadata)?; + + let asset_id = get_asset_id(&merkle_tree.key(), nonce); + let previous_leaf = LeafSchema::new_v0( + asset_id, + owner.key(), + delegate.key(), + nonce, + old_data_hash, + creator_hash, + ); + let new_leaf = LeafSchema::new_v0( + asset_id, + owner.key(), + delegate.key(), + nonce, + new_data_hash, + creator_hash, + ); + + wrap_application_data_v1(new_leaf.to_event().try_to_vec()?, &ctx.accounts.log_wrapper)?; + + replace_leaf( + &merkle_tree.key(), + *ctx.bumps.get("tree_authority").unwrap(), + &ctx.accounts.compression_program.to_account_info(), + &ctx.accounts.tree_authority.to_account_info(), + &ctx.accounts.merkle_tree.to_account_info(), + &ctx.accounts.log_wrapper.to_account_info(), + ctx.remaining_accounts, + root, + previous_leaf.to_node(), + new_leaf.to_node(), + index, + ) + } + pub fn redeem<'info>( ctx: Context<'_, '_, '_, 'info, Redeem<'info>>, root: [u8; 32], From 0494b7a12d962082b91c0cfa3671be05f515a000 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Sun, 25 Jun 2023 21:46:39 -0400 Subject: [PATCH 02/17] allow updating creators without new verifications --- programs/bubblegum/program/src/lib.rs | 34 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 36b57e8a..a2e93553 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -1425,6 +1425,7 @@ pub mod bubblegum { new_name: Option, new_symbol: Option, new_uri: Option, + new_creators: Option>, new_seller_fee_basis_points: Option, new_primary_sale_happened: Option, new_is_mutable: Option, @@ -1447,11 +1448,17 @@ pub mod bubblegum { let old_metadata = match old_metadata { Some(metadata) => { - require!(ctx.accounts.old_metadata.is_none(), BubblegumError::MetadataArgsAmbiguous); + require!( + ctx.accounts.old_metadata.is_none(), + BubblegumError::MetadataArgsAmbiguous + ); metadata } None => { - require!(ctx.accounts.old_metadata.is_some(), BubblegumError::MetadataArgsMissing); + require!( + ctx.accounts.old_metadata.is_some(), + BubblegumError::MetadataArgsMissing + ); let old_metadata_account = ctx.accounts.old_metadata.as_ref().unwrap(); let old_metadata_data = old_metadata_account.try_borrow_mut_data()?; let mut old_metadata_data_slice = old_metadata_data.as_ref(); @@ -1490,7 +1497,7 @@ pub mod bubblegum { } let old_data_hash = hash_metadata(&old_metadata)?; - let creator_hash = hash_creators(&old_metadata.creators)?; + let old_creator_hash = hash_creators(&old_metadata.creators)?; // Update metadata let mut new_metadata = old_metadata; @@ -1503,6 +1510,22 @@ pub mod bubblegum { if let Some(uri) = new_uri { new_metadata.uri = uri; }; + if let Some(creators) = new_creators { + let old_creators = new_metadata.creators; + let no_creators_were_verified = creators + .iter() + .filter(|c| c.verified) // select only creators that are verified + .all(|c| { + old_creators + .iter() + .any(|old| old.address == c.address && old.verified) + }); + require!( + no_creators_were_verified, + BubblegumError::CreatorDidNotVerify + ); + new_metadata.creators = creators; + } if let Some(seller_fee_basis_points) = new_seller_fee_basis_points { new_metadata.seller_fee_basis_points = seller_fee_basis_points }; @@ -1518,6 +1541,7 @@ pub mod bubblegum { // ensure new metadata is mpl_compatible assert_metadata_is_mpl_compatible(&new_metadata)?; let new_data_hash = hash_metadata(&new_metadata)?; + let new_creator_hash = hash_creators(&new_metadata.creators)?; let asset_id = get_asset_id(&merkle_tree.key(), nonce); let previous_leaf = LeafSchema::new_v0( @@ -1526,7 +1550,7 @@ pub mod bubblegum { delegate.key(), nonce, old_data_hash, - creator_hash, + old_creator_hash, ); let new_leaf = LeafSchema::new_v0( asset_id, @@ -1534,7 +1558,7 @@ pub mod bubblegum { delegate.key(), nonce, new_data_hash, - creator_hash, + new_creator_hash, ); wrap_application_data_v1(new_leaf.to_event().try_to_vec()?, &ctx.accounts.log_wrapper)?; From 922e3c597245fa5a2554196a59c09a4c6aebed57 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Sun, 25 Jun 2023 22:22:17 -0400 Subject: [PATCH 03/17] cleanup --- programs/bubblegum/program/src/error.rs | 2 + programs/bubblegum/program/src/lib.rs | 76 +++++++++++-------------- 2 files changed, 34 insertions(+), 44 deletions(-) diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index 1522a02d..f4610ed9 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -80,6 +80,8 @@ pub enum BubblegumError { MetadataArgsAmbiguous, #[msg("MetadataArgs Missing")] MetadataArgsMissing, + #[msg("Missing Collection Authority Signature")] + MissingCollectionAuthoritySignature, } // Converts certain Token Metadata errors into Bubblegum equivalents diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index a2e93553..83b459d8 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -716,41 +716,6 @@ fn process_creator_verification<'info>( ) } -// TODO sorend: simplify with the function below -fn assert_signed_by_collection_authority<'info>( - collection_metadata: &Account<'info, TokenMetadata>, - collection_mint: &AccountInfo<'info>, - collection_authority: &AccountInfo<'info>, - collection_authority_record_pda: &AccountInfo<'info>, - token_metadata_program: &AccountInfo<'info>, -) -> Result<()> { - // See if a collection authority record PDA was provided. - let collection_authority_record = if collection_authority_record_pda.key() == crate::id() { - None - } else { - Some(collection_authority_record_pda) - }; - - // Verify correct account ownerships. - require!( - *collection_metadata.to_account_info().owner == token_metadata_program.key(), - BubblegumError::IncorrectOwner - ); - require!( - *collection_mint.owner == spl_token::id(), - BubblegumError::IncorrectOwner - ); - - // Collection authority assert from token-metadata. - assert_has_collection_authority( - collection_authority, - collection_metadata, - collection_mint.key, - collection_authority_record, - )?; - Ok(()) -} - fn process_collection_verification_mpl_only<'info>( collection_metadata: &Account<'info, TokenMetadata>, collection_mint: &AccountInfo<'info>, @@ -1446,6 +1411,7 @@ pub mod bubblegum { ); } + // Determine how the user opted to pass in the old MetadataArgs let old_metadata = match old_metadata { Some(metadata) => { require!( @@ -1478,20 +1444,43 @@ pub mod bubblegum { ctx.accounts.collection_mint.key() == collection.key, BubblegumError::CollectionMismatch ); - let collection_metadata = &ctx.accounts.collection_metadata; + + // Since this NFT is part of a verified collection, require that a CollectionAuthority signed + require!( + ctx.accounts.collection_authority.is_signer, + BubblegumError::MissingCollectionAuthoritySignature + ); + let collection_mint = ctx.accounts.collection_mint.to_account_info(); - let collection_authority = ctx.accounts.collection_authority.to_account_info(); let collection_authority_record_pda = ctx .accounts .collection_authority_record_pda .to_account_info(); let token_metadata_program = ctx.accounts.token_metadata_program.to_account_info(); - assert_signed_by_collection_authority( - collection_metadata, - &collection_mint, - &collection_authority, - &collection_authority_record_pda, - &token_metadata_program, + + // Verify correct account ownerships. + require!( + *ctx.accounts.collection_metadata.to_account_info().owner == token_metadata_program.key(), + BubblegumError::IncorrectOwner + ); + require!( + *collection_mint.owner == spl_token::id(), + BubblegumError::IncorrectOwner + ); + + // Get collection_authority_record, if provided + let collection_authority_record = if collection_authority_record_pda.key() == crate::id() { + None + } else { + Some(&collection_authority_record_pda) + }; + + // Assert that the correct Collection Authority was provided using token-metadata + assert_has_collection_authority( + &ctx.accounts.collection_authority.to_account_info(), + &ctx.accounts.collection_metadata, + collection_mint.key, + collection_authority_record, )?; } } @@ -1538,7 +1527,6 @@ pub mod bubblegum { new_metadata.is_mutable = is_mutable; }; - // ensure new metadata is mpl_compatible assert_metadata_is_mpl_compatible(&new_metadata)?; let new_data_hash = hash_metadata(&new_metadata)?; let new_creator_hash = hash_creators(&new_metadata.creators)?; From b1e970d2d75d2646808f00fae1b92ebda8cc2664 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 14:38:35 -0400 Subject: [PATCH 04/17] conflicts --- .../js/src/generated/errors/mplBubblegum.ts | 48 +++ .../js/src/generated/instructions/index.ts | 1 + .../generated/instructions/updateMetadata.ts | 285 ++++++++++++++++++ .../js/src/generated/types/instructionName.ts | 1 + idls/bubblegum.json | 191 ++++++++++++ 5 files changed, 526 insertions(+) create mode 100644 clients/js/src/generated/instructions/updateMetadata.ts diff --git a/clients/js/src/generated/errors/mplBubblegum.ts b/clients/js/src/generated/errors/mplBubblegum.ts index 60c6ea5e..2d18b383 100644 --- a/clients/js/src/generated/errors/mplBubblegum.ts +++ b/clients/js/src/generated/errors/mplBubblegum.ts @@ -394,6 +394,9 @@ nameToErrorMap.set('CollectionMustBeSized', CollectionMustBeSizedError); /** MetadataMintMismatch: Metadata mint does not match collection mint */ export class MetadataMintMismatchError extends ProgramError { readonly name: string = 'MetadataMintMismatch'; +/** MetadataImmutable: Metadata Not Mutable */ +export class MetadataImmutableError extends ProgramError { + readonly name: string = 'MetadataImmutable'; readonly code: number = 0x178b; // 6027 @@ -407,6 +410,15 @@ nameToErrorMap.set('MetadataMintMismatch', MetadataMintMismatchError); /** InvalidCollectionAuthority: Invalid collection authority */ export class InvalidCollectionAuthorityError extends ProgramError { readonly name: string = 'InvalidCollectionAuthority'; + super('Metadata Not Mutable', program, cause); + } +} +codeToErrorMap.set(0x178b, MetadataImmutableError); +nameToErrorMap.set('MetadataImmutable', MetadataImmutableError); + +/** CollectionMismatch: Collection mismatch */ +export class CollectionMismatchError extends ProgramError { + readonly name: string = 'CollectionMismatch'; readonly code: number = 0x178c; // 6028 @@ -423,6 +435,15 @@ nameToErrorMap.set( /** InvalidDelegateRecord: Invalid delegate record pda derivation */ export class InvalidDelegateRecordError extends ProgramError { readonly name: string = 'InvalidDelegateRecord'; + super('Collection mismatch', program, cause); + } +} +codeToErrorMap.set(0x178c, CollectionMismatchError); +nameToErrorMap.set('CollectionMismatch', CollectionMismatchError); + +/** MetadataArgsAmbiguous: MetadataArgs Ambiguous */ +export class MetadataArgsAmbiguousError extends ProgramError { + readonly name: string = 'MetadataArgsAmbiguous'; readonly code: number = 0x178d; // 6029 @@ -436,6 +457,15 @@ nameToErrorMap.set('InvalidDelegateRecord', InvalidDelegateRecordError); /** CollectionMasterEditionAccountInvalid: Edition account doesnt match collection */ export class CollectionMasterEditionAccountInvalidError extends ProgramError { readonly name: string = 'CollectionMasterEditionAccountInvalid'; + super('MetadataArgs Ambiguous', program, cause); + } +} +codeToErrorMap.set(0x178d, MetadataArgsAmbiguousError); +nameToErrorMap.set('MetadataArgsAmbiguous', MetadataArgsAmbiguousError); + +/** MetadataArgsMissing: MetadataArgs Missing */ +export class MetadataArgsMissingError extends ProgramError { + readonly name: string = 'MetadataArgsMissing'; readonly code: number = 0x178e; // 6030 @@ -452,6 +482,15 @@ nameToErrorMap.set( /** CollectionMustBeAUniqueMasterEdition: Collection Must Be a Unique Master Edition v2 */ export class CollectionMustBeAUniqueMasterEditionError extends ProgramError { readonly name: string = 'CollectionMustBeAUniqueMasterEdition'; + super('MetadataArgs Missing', program, cause); + } +} +codeToErrorMap.set(0x178e, MetadataArgsMissingError); +nameToErrorMap.set('MetadataArgsMissing', MetadataArgsMissingError); + +/** MissingCollectionAuthoritySignature: Missing Collection Authority Signature */ +export class MissingCollectionAuthoritySignatureError extends ProgramError { + readonly name: string = 'MissingCollectionAuthoritySignature'; readonly code: number = 0x178f; // 6031 @@ -491,6 +530,15 @@ export class DecompressionDisabledError extends ProgramError { codeToErrorMap.set(0x1791, DecompressionDisabledError); nameToErrorMap.set('DecompressionDisabled', DecompressionDisabledError); + super('Missing Collection Authority Signature', program, cause); + } +} +codeToErrorMap.set(0x178f, MissingCollectionAuthoritySignatureError); +nameToErrorMap.set( + 'MissingCollectionAuthoritySignature', + MissingCollectionAuthoritySignatureError +); + /** * Attempts to resolve a custom program error from the provided error code. * @category Errors diff --git a/clients/js/src/generated/instructions/index.ts b/clients/js/src/generated/instructions/index.ts index 30a20fe1..e281f2b9 100644 --- a/clients/js/src/generated/instructions/index.ts +++ b/clients/js/src/generated/instructions/index.ts @@ -20,6 +20,7 @@ export * from './setTreeDelegate'; export * from './transfer'; export * from './unverifyCollection'; export * from './unverifyCreator'; +export * from './updateMetadata'; export * from './verifyCollection'; export * from './verifyCreator'; export * from './verifyLeaf'; diff --git a/clients/js/src/generated/instructions/updateMetadata.ts b/clients/js/src/generated/instructions/updateMetadata.ts new file mode 100644 index 00000000..c6b04fcf --- /dev/null +++ b/clients/js/src/generated/instructions/updateMetadata.ts @@ -0,0 +1,285 @@ +/** + * 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 { + AccountMeta, + Context, + Option, + OptionOrNullable, + Pda, + PublicKey, + Signer, + TransactionBuilder, + publicKey, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + array, + bool, + bytes, + mapSerializer, + option, + string, + struct, + u16, + u32, + u64, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { findTreeConfigPda } from '../accounts'; +import { addAccountMeta, addObjectProperty } from '../shared'; +import { + Creator, + CreatorArgs, + MetadataArgs, + MetadataArgsArgs, + getCreatorSerializer, + getMetadataArgsSerializer, +} from '../types'; + +// Accounts. +export type UpdateMetadataInstructionAccounts = { + oldMetadata?: PublicKey | Pda; + treeAuthority?: PublicKey | Pda; + treeDelegate: Signer; + collectionAuthority: PublicKey | Pda; + collectionMint: PublicKey | Pda; + collectionMetadata: PublicKey | Pda; + collectionAuthorityRecordPda: PublicKey | Pda; + leafOwner: PublicKey | Pda; + leafDelegate: PublicKey | Pda; + payer?: Signer; + merkleTree: PublicKey | Pda; + logWrapper?: PublicKey | Pda; + compressionProgram?: PublicKey | Pda; + tokenMetadataProgram?: PublicKey | Pda; + systemProgram?: PublicKey | Pda; +}; + +// Data. +export type UpdateMetadataInstructionData = { + discriminator: Array; + root: Uint8Array; + oldMetadata: Option; + newName: Option; + newSymbol: Option; + newUri: Option; + newCreators: Option>; + newSellerFeeBasisPoints: Option; + newPrimarySaleHappened: Option; + newIsMutable: Option; + nonce: bigint; + index: number; +}; + +export type UpdateMetadataInstructionDataArgs = { + root: Uint8Array; + oldMetadata: OptionOrNullable; + newName: OptionOrNullable; + newSymbol: OptionOrNullable; + newUri: OptionOrNullable; + newCreators: OptionOrNullable>; + newSellerFeeBasisPoints: OptionOrNullable; + newPrimarySaleHappened: OptionOrNullable; + newIsMutable: OptionOrNullable; + nonce: number | bigint; + index: number; +}; + +/** @deprecated Use `getUpdateMetadataInstructionDataSerializer()` without any argument instead. */ +export function getUpdateMetadataInstructionDataSerializer( + _context: object +): Serializer; +export function getUpdateMetadataInstructionDataSerializer(): Serializer< + UpdateMetadataInstructionDataArgs, + UpdateMetadataInstructionData +>; +export function getUpdateMetadataInstructionDataSerializer( + _context: object = {} +): Serializer< + UpdateMetadataInstructionDataArgs, + UpdateMetadataInstructionData +> { + return mapSerializer< + UpdateMetadataInstructionDataArgs, + any, + UpdateMetadataInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['root', bytes({ size: 32 })], + ['oldMetadata', option(getMetadataArgsSerializer())], + ['newName', option(string())], + ['newSymbol', option(string())], + ['newUri', option(string())], + ['newCreators', option(array(getCreatorSerializer()))], + ['newSellerFeeBasisPoints', option(u16())], + ['newPrimarySaleHappened', option(bool())], + ['newIsMutable', option(bool())], + ['nonce', u64()], + ['index', u32()], + ], + { description: 'UpdateMetadataInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [170, 182, 43, 239, 97, 78, 225, 186], + }) + ) as Serializer< + UpdateMetadataInstructionDataArgs, + UpdateMetadataInstructionData + >; +} + +// Args. +export type UpdateMetadataInstructionArgs = UpdateMetadataInstructionDataArgs; + +// Instruction. +export function updateMetadata( + context: Pick, + accounts: UpdateMetadataInstructionAccounts, + args: UpdateMetadataInstructionArgs +): TransactionBuilder { + const signers: Signer[] = []; + const keys: AccountMeta[] = []; + + // Program ID. + const programId = context.programs.getPublicKey( + 'mplBubblegum', + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ); + + // Resolved inputs. + const resolvedAccounts = { + treeDelegate: [accounts.treeDelegate, false] as const, + collectionAuthority: [accounts.collectionAuthority, false] as const, + collectionMint: [accounts.collectionMint, false] as const, + collectionMetadata: [accounts.collectionMetadata, false] as const, + collectionAuthorityRecordPda: [ + accounts.collectionAuthorityRecordPda, + false, + ] as const, + leafOwner: [accounts.leafOwner, false] as const, + leafDelegate: [accounts.leafDelegate, false] as const, + merkleTree: [accounts.merkleTree, true] as const, + }; + const resolvingArgs = {}; + addObjectProperty( + resolvedAccounts, + 'oldMetadata', + accounts.oldMetadata + ? ([accounts.oldMetadata, false] as const) + : ([programId, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'treeAuthority', + accounts.treeAuthority + ? ([accounts.treeAuthority, false] as const) + : ([ + findTreeConfigPda(context, { + merkleTree: publicKey(accounts.merkleTree, false), + }), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'payer', + accounts.payer + ? ([accounts.payer, false] as const) + : ([context.payer, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'logWrapper', + accounts.logWrapper + ? ([accounts.logWrapper, false] as const) + : ([ + context.programs.getPublicKey( + 'splNoop', + 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV' + ), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'compressionProgram', + accounts.compressionProgram + ? ([accounts.compressionProgram, false] as const) + : ([ + context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'tokenMetadataProgram', + accounts.tokenMetadataProgram + ? ([accounts.tokenMetadataProgram, false] as const) + : ([ + context.programs.getPublicKey( + 'mplTokenMetadata', + 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + ), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'systemProgram', + accounts.systemProgram + ? ([accounts.systemProgram, false] as const) + : ([ + context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ), + false, + ] as const) + ); + const resolvedArgs = { ...args, ...resolvingArgs }; + + addAccountMeta(keys, signers, resolvedAccounts.oldMetadata, false); + addAccountMeta(keys, signers, resolvedAccounts.treeAuthority, false); + addAccountMeta(keys, signers, resolvedAccounts.treeDelegate, false); + addAccountMeta(keys, signers, resolvedAccounts.collectionAuthority, false); + addAccountMeta(keys, signers, resolvedAccounts.collectionMint, false); + addAccountMeta(keys, signers, resolvedAccounts.collectionMetadata, false); + addAccountMeta( + keys, + signers, + resolvedAccounts.collectionAuthorityRecordPda, + false + ); + addAccountMeta(keys, signers, resolvedAccounts.leafOwner, false); + addAccountMeta(keys, signers, resolvedAccounts.leafDelegate, false); + addAccountMeta(keys, signers, resolvedAccounts.payer, false); + addAccountMeta(keys, signers, resolvedAccounts.merkleTree, false); + addAccountMeta(keys, signers, resolvedAccounts.logWrapper, false); + addAccountMeta(keys, signers, resolvedAccounts.compressionProgram, false); + addAccountMeta(keys, signers, resolvedAccounts.tokenMetadataProgram, false); + addAccountMeta(keys, signers, resolvedAccounts.systemProgram, false); + + // Data. + const data = + getUpdateMetadataInstructionDataSerializer().serialize(resolvedArgs); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/types/instructionName.ts b/clients/js/src/generated/types/instructionName.ts index 57406be2..473a0ffd 100644 --- a/clients/js/src/generated/types/instructionName.ts +++ b/clients/js/src/generated/types/instructionName.ts @@ -26,6 +26,7 @@ export enum InstructionName { SetAndVerifyCollection, MintToCollectionV1, SetDecompressableState, + UpdateMetadata, } export type InstructionNameArgs = InstructionName; diff --git a/idls/bubblegum.json b/idls/bubblegum.json index 18bb4c6c..9ac8d6c0 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1083,6 +1083,169 @@ } ] }, + { + "name": "updateMetadata", + "accounts": [ + { + "name": "oldMetadata", + "isMut": false, + "isSigner": false, + "isOptional": true + }, + { + "name": "treeAuthority", + "isMut": false, + "isSigner": false, + "pda": { + "seeds": [ + { + "kind": "account", + "type": "publicKey", + "path": "merkle_tree" + } + ] + } + }, + { + "name": "treeDelegate", + "isMut": false, + "isSigner": true + }, + { + "name": "collectionAuthority", + "isMut": false, + "isSigner": false + }, + { + "name": "collectionMint", + "isMut": false, + "isSigner": false + }, + { + "name": "collectionMetadata", + "isMut": false, + "isSigner": false + }, + { + "name": "collectionAuthorityRecordPda", + "isMut": false, + "isSigner": false + }, + { + "name": "leafOwner", + "isMut": false, + "isSigner": false + }, + { + "name": "leafDelegate", + "isMut": false, + "isSigner": false + }, + { + "name": "payer", + "isMut": false, + "isSigner": true + }, + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false + }, + { + "name": "compressionProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "tokenMetadataProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "root", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "oldMetadata", + "type": { + "option": { + "defined": "MetadataArgs" + } + } + }, + { + "name": "newName", + "type": { + "option": "string" + } + }, + { + "name": "newSymbol", + "type": { + "option": "string" + } + }, + { + "name": "newUri", + "type": { + "option": "string" + } + }, + { + "name": "newCreators", + "type": { + "option": { + "vec": { + "defined": "Creator" + } + } + } + }, + { + "name": "newSellerFeeBasisPoints", + "type": { + "option": "u16" + } + }, + { + "name": "newPrimarySaleHappened", + "type": { + "option": "bool" + } + }, + { + "name": "newIsMutable", + "type": { + "option": "bool" + } + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "index", + "type": "u32" + } + ] + }, { "name": "redeem", "accounts": [ @@ -1803,6 +1966,9 @@ }, { "name": "SetDecompressableState" + }, + { + "name": "UpdateMetadata" } ] } @@ -1978,6 +2144,31 @@ "code": 6033, "name": "DecompressionDisabled", "msg": "Decompression is disabled for this tree." + }, + { + "code": 6034, + "name": "MetadataImmutable", + "msg": "Metadata Not Mutable" + }, + { + "code": 6035, + "name": "CollectionMismatch", + "msg": "Collection mismatch" + }, + { + "code": 6036, + "name": "MetadataArgsAmbiguous", + "msg": "MetadataArgs Ambiguous" + }, + { + "code": 6037, + "name": "MetadataArgsMissing", + "msg": "MetadataArgs Missing" + }, + { + "code": 6038, + "name": "MissingCollectionAuthoritySignature", + "msg": "Missing Collection Authority Signature" } ], "metadata": { From fdc2fff81d8d66135e0701a3babb66653cf43ea4 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 14:44:36 -0400 Subject: [PATCH 05/17] conflicts --- clients/js-solita/.prettierignore | 2 - clients/js-solita/package.json | 7 +- .../src/generated/accounts/TreeConfig.ts | 63 +- .../src/generated/accounts/Voucher.ts | 69 +- .../js-solita/src/generated/accounts/index.ts | 10 +- .../js-solita/src/generated/errors/index.ts | 543 ++++-- clients/js-solita/src/generated/index.ts | 14 +- .../src/generated/instructions/burn.ts | 54 +- .../generated/instructions/cancelRedeem.ts | 48 +- .../src/generated/instructions/compress.ts | 60 +- .../src/generated/instructions/createTree.ts | 52 +- .../generated/instructions/decompressV1.ts | 64 +- .../src/generated/instructions/delegate.ts | 58 +- .../src/generated/instructions/index.ts | 2 + .../instructions/mintToCollectionV1.ts | 68 +- .../src/generated/instructions/mintV1.ts | 54 +- .../src/generated/instructions/redeem.ts | 58 +- .../instructions/setAndVerifyCollection.ts | 80 +- .../generated/instructions/setTreeDelegate.ts | 40 +- .../src/generated/instructions/transfer.ts | 58 +- .../instructions/unverifyCollection.ts | 78 +- .../generated/instructions/unverifyCreator.ts | 64 +- .../generated/instructions/updateMetadata.ts | 182 ++ .../updateMetadataCollectionNft.ts | 211 +++ .../instructions/verifyCollection.ts | 78 +- .../generated/instructions/verifyCreator.ts | 64 +- .../src/generated/types/BubblegumEventType.ts | 6 +- .../src/generated/types/Collection.ts | 16 +- .../js-solita/src/generated/types/Creator.ts | 18 +- .../src/generated/types/InstructionName.ts | 8 +- .../src/generated/types/LeafSchema.ts | 31 +- .../src/generated/types/MetadataArgs.ts | 45 +- .../generated/types/TokenProgramVersion.ts | 6 +- .../src/generated/types/TokenStandard.ts | 7 +- .../src/generated/types/UseMethod.ts | 7 +- clients/js-solita/src/generated/types/Uses.ts | 16 +- .../js-solita/src/generated/types/Version.ts | 7 +- clients/js-solita/tests/main.test.ts | 354 +++- clients/js-solita/yarn.lock | 1476 ++++++++++++++++- .../generated/instructions/updateMetadata.ts | 57 +- idls/bubblegum.json | 169 +- programs/bubblegum/program/src/error.rs | 4 +- programs/bubblegum/program/src/lib.rs | 462 ++++-- 43 files changed, 3723 insertions(+), 1047 deletions(-) delete mode 100644 clients/js-solita/.prettierignore create mode 100644 clients/js-solita/src/generated/instructions/updateMetadata.ts create mode 100644 clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts diff --git a/clients/js-solita/.prettierignore b/clients/js-solita/.prettierignore deleted file mode 100644 index de4d1f00..00000000 --- a/clients/js-solita/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -dist -node_modules diff --git a/clients/js-solita/package.json b/clients/js-solita/package.json index 4d243f7c..ba4b4266 100644 --- a/clients/js-solita/package.json +++ b/clients/js-solita/package.json @@ -13,7 +13,7 @@ "postpublish": "git push origin && git push origin --tags", "build:docs": "typedoc", "build": "rimraf dist && tsc -p tsconfig.json", - "start-validator": "solana-test-validator -ud --quiet --reset -c cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK -c 4VTQredsAmr1yzRJugLV6Mt6eu6XMeCwdkZ73wwVMWHv -c noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV -c 3RHkdjCwWyK2firrwFQGvXCxbUpBky1GTmb9EDK9hUnX -c metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s -c PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT --bpf-program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY ../../programs/.bin/mpl_bubblegum.so", + "start-validator": "solana-test-validator -ud --reset -c cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK -c 4VTQredsAmr1yzRJugLV6Mt6eu6XMeCwdkZ73wwVMWHv -c noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV -c 3RHkdjCwWyK2firrwFQGvXCxbUpBky1GTmb9EDK9hUnX -c metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s -c PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT -c TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA -c ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL --bpf-program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY ../../programs/.bin/mpl_bubblegum.so", "run-tests": "jest tests --detectOpenHandles", "test": "start-server-and-test start-validator http://localhost:8899/health run-tests", "api:gen": "DEBUG='(solita|rustbin):(info|error)' solita", @@ -54,12 +54,13 @@ "@metaplex-foundation/amman": "0.12.1", "@metaplex-foundation/rustbin": "^0.3.5", "@metaplex-foundation/solita": "0.20.0", + "@metaplex-foundation/js": "^0.19.4", "@solana/spl-account-compression": "^0.1.4", + "@types/bn.js": "^5.1.1", "@types/chai": "^4.3.0", "@types/jest": "^29.1.1", "@types/mocha": "^9.0.0", "@types/tape": "^4.13.2", - "@types/bn.js": "^5.1.1", "@typescript-eslint/eslint-plugin": "^5.4.0", "@typescript-eslint/parser": "^5.4.0", "chai": "^4.3.4", @@ -80,4 +81,4 @@ "typescript": "^4.3.5", "typescript-collections": "^1.3.3" } -} \ No newline at end of file +} diff --git a/clients/js-solita/src/generated/accounts/TreeConfig.ts b/clients/js-solita/src/generated/accounts/TreeConfig.ts index b01c8c5d..b693c157 100644 --- a/clients/js-solita/src/generated/accounts/TreeConfig.ts +++ b/clients/js-solita/src/generated/accounts/TreeConfig.ts @@ -24,7 +24,7 @@ export type TreeConfigArgs = { isDecompressable: DecompressableState; }; -export const treeConfigDiscriminator = [122, 245, 175, 248, 171, 34, 0, 207]; +export const treeConfigDiscriminator = [122, 245, 175, 248, 171, 34, 0, 207] /** * Holds the data for the {@link TreeConfig} Account and provides de/serialization * functionality for that data @@ -60,8 +60,11 @@ export class TreeConfig implements TreeConfigArgs { * Deserializes the {@link TreeConfig} from the data of the provided {@link web3.AccountInfo}. * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ - static fromAccountInfo(accountInfo: web3.AccountInfo, offset = 0): [TreeConfig, number] { - return TreeConfig.deserialize(accountInfo.data, offset); + static fromAccountInfo( + accountInfo: web3.AccountInfo, + offset = 0 + ): [TreeConfig, number] { + return TreeConfig.deserialize(accountInfo.data, offset) } /** @@ -73,13 +76,16 @@ export class TreeConfig implements TreeConfigArgs { static async fromAccountAddress( connection: web3.Connection, address: web3.PublicKey, - commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, + commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig ): Promise { - const accountInfo = await connection.getAccountInfo(address, commitmentOrConfig); + const accountInfo = await connection.getAccountInfo( + address, + commitmentOrConfig + ) if (accountInfo == null) { - throw new Error(`Unable to find TreeConfig account at ${address}`); + throw new Error(`Unable to find TreeConfig account at ${address}`) } - return TreeConfig.fromAccountInfo(accountInfo, 0)[0]; + return TreeConfig.fromAccountInfo(accountInfo, 0)[0] } /** @@ -89,9 +95,11 @@ export class TreeConfig implements TreeConfigArgs { * @param programId - the program that owns the accounts we are filtering */ static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId: web3.PublicKey = new web3.PublicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ) ) { - return beetSolana.GpaBuilder.fromStruct(programId, treeConfigBeet); + return beetSolana.GpaBuilder.fromStruct(programId, treeConfigBeet) } /** @@ -99,7 +107,7 @@ export class TreeConfig implements TreeConfigArgs { * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ static deserialize(buf: Buffer, offset = 0): [TreeConfig, number] { - return treeConfigBeet.deserialize(buf, offset); + return treeConfigBeet.deserialize(buf, offset) } /** @@ -110,7 +118,7 @@ export class TreeConfig implements TreeConfigArgs { return treeConfigBeet.serialize({ accountDiscriminator: treeConfigDiscriminator, ...this, - }); + }) } /** @@ -118,7 +126,7 @@ export class TreeConfig implements TreeConfigArgs { * {@link TreeConfig} */ static get byteSize() { - return treeConfigBeet.byteSize; + return treeConfigBeet.byteSize } /** @@ -129,9 +137,12 @@ export class TreeConfig implements TreeConfigArgs { */ static async getMinimumBalanceForRentExemption( connection: web3.Connection, - commitment?: web3.Commitment, + commitment?: web3.Commitment ): Promise { - return connection.getMinimumBalanceForRentExemption(TreeConfig.byteSize, commitment); + return connection.getMinimumBalanceForRentExemption( + TreeConfig.byteSize, + commitment + ) } /** @@ -139,7 +150,7 @@ export class TreeConfig implements TreeConfigArgs { * hold {@link TreeConfig} data. */ static hasCorrectByteSize(buf: Buffer, offset = 0) { - return buf.byteLength - offset === TreeConfig.byteSize; + return buf.byteLength - offset === TreeConfig.byteSize } /** @@ -151,26 +162,26 @@ export class TreeConfig implements TreeConfigArgs { treeCreator: this.treeCreator.toBase58(), treeDelegate: this.treeDelegate.toBase58(), totalMintCapacity: (() => { - const x = <{ toNumber: () => number }>this.totalMintCapacity; + const x = <{ toNumber: () => number }>this.totalMintCapacity if (typeof x.toNumber === 'function') { try { - return x.toNumber(); + return x.toNumber() } catch (_) { - return x; + return x } } - return x; + return x })(), numMinted: (() => { - const x = <{ toNumber: () => number }>this.numMinted; + const x = <{ toNumber: () => number }>this.numMinted if (typeof x.toNumber === 'function') { try { - return x.toNumber(); + return x.toNumber() } catch (_) { - return x; + return x } } - return x; + return x })(), isPublic: this.isPublic, isDecompressable: 'DecompressableState.' + DecompressableState[this.isDecompressable], @@ -185,7 +196,7 @@ export class TreeConfig implements TreeConfigArgs { export const treeConfigBeet = new beet.BeetStruct< TreeConfig, TreeConfigArgs & { - accountDiscriminator: number[] /* size: 8 */; + accountDiscriminator: number[] /* size: 8 */ } >( [ @@ -198,5 +209,5 @@ export const treeConfigBeet = new beet.BeetStruct< ['isDecompressable', decompressableStateBeet], ], TreeConfig.fromArgs, - 'TreeConfig', -); + 'TreeConfig' +) diff --git a/clients/js-solita/src/generated/accounts/Voucher.ts b/clients/js-solita/src/generated/accounts/Voucher.ts index 46c12205..0f19f266 100644 --- a/clients/js-solita/src/generated/accounts/Voucher.ts +++ b/clients/js-solita/src/generated/accounts/Voucher.ts @@ -5,10 +5,10 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js'; -import * as beet from '@metaplex-foundation/beet'; -import * as beetSolana from '@metaplex-foundation/beet-solana'; -import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema'; +import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet' +import * as beetSolana from '@metaplex-foundation/beet-solana' +import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema' /** * Arguments used to create {@link Voucher} @@ -16,12 +16,12 @@ import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema'; * @category generated */ export type VoucherArgs = { - leafSchema: LeafSchema; - index: number; - merkleTree: web3.PublicKey; -}; + leafSchema: LeafSchema + index: number + merkleTree: web3.PublicKey +} -export const voucherDiscriminator = [191, 204, 149, 234, 213, 165, 13, 65]; +export const voucherDiscriminator = [191, 204, 149, 234, 213, 165, 13, 65] /** * Holds the data for the {@link Voucher} Account and provides de/serialization * functionality for that data @@ -33,22 +33,25 @@ export class Voucher implements VoucherArgs { private constructor( readonly leafSchema: LeafSchema, readonly index: number, - readonly merkleTree: web3.PublicKey, + readonly merkleTree: web3.PublicKey ) {} /** * Creates a {@link Voucher} instance from the provided args. */ static fromArgs(args: VoucherArgs) { - return new Voucher(args.leafSchema, args.index, args.merkleTree); + return new Voucher(args.leafSchema, args.index, args.merkleTree) } /** * Deserializes the {@link Voucher} from the data of the provided {@link web3.AccountInfo}. * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ - static fromAccountInfo(accountInfo: web3.AccountInfo, offset = 0): [Voucher, number] { - return Voucher.deserialize(accountInfo.data, offset); + static fromAccountInfo( + accountInfo: web3.AccountInfo, + offset = 0 + ): [Voucher, number] { + return Voucher.deserialize(accountInfo.data, offset) } /** @@ -60,13 +63,16 @@ export class Voucher implements VoucherArgs { static async fromAccountAddress( connection: web3.Connection, address: web3.PublicKey, - commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, + commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig ): Promise { - const accountInfo = await connection.getAccountInfo(address, commitmentOrConfig); + const accountInfo = await connection.getAccountInfo( + address, + commitmentOrConfig + ) if (accountInfo == null) { - throw new Error(`Unable to find Voucher account at ${address}`); + throw new Error(`Unable to find Voucher account at ${address}`) } - return Voucher.fromAccountInfo(accountInfo, 0)[0]; + return Voucher.fromAccountInfo(accountInfo, 0)[0] } /** @@ -76,9 +82,11 @@ export class Voucher implements VoucherArgs { * @param programId - the program that owns the accounts we are filtering */ static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId: web3.PublicKey = new web3.PublicKey( + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ) ) { - return beetSolana.GpaBuilder.fromStruct(programId, voucherBeet); + return beetSolana.GpaBuilder.fromStruct(programId, voucherBeet) } /** @@ -86,7 +94,7 @@ export class Voucher implements VoucherArgs { * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ static deserialize(buf: Buffer, offset = 0): [Voucher, number] { - return voucherBeet.deserialize(buf, offset); + return voucherBeet.deserialize(buf, offset) } /** @@ -97,7 +105,7 @@ export class Voucher implements VoucherArgs { return voucherBeet.serialize({ accountDiscriminator: voucherDiscriminator, ...this, - }); + }) } /** @@ -108,11 +116,11 @@ export class Voucher implements VoucherArgs { * depends on them */ static byteSize(args: VoucherArgs) { - const instance = Voucher.fromArgs(args); + const instance = Voucher.fromArgs(args) return voucherBeet.toFixedFromValue({ accountDiscriminator: voucherDiscriminator, ...instance, - }).byteSize; + }).byteSize } /** @@ -126,9 +134,12 @@ export class Voucher implements VoucherArgs { static async getMinimumBalanceForRentExemption( args: VoucherArgs, connection: web3.Connection, - commitment?: web3.Commitment, + commitment?: web3.Commitment ): Promise { - return connection.getMinimumBalanceForRentExemption(Voucher.byteSize(args), commitment); + return connection.getMinimumBalanceForRentExemption( + Voucher.byteSize(args), + commitment + ) } /** @@ -140,7 +151,7 @@ export class Voucher implements VoucherArgs { leafSchema: this.leafSchema.__kind, index: this.index, merkleTree: this.merkleTree.toBase58(), - }; + } } } @@ -151,7 +162,7 @@ export class Voucher implements VoucherArgs { export const voucherBeet = new beet.FixableBeetStruct< Voucher, VoucherArgs & { - accountDiscriminator: number[] /* size: 8 */; + accountDiscriminator: number[] /* size: 8 */ } >( [ @@ -161,5 +172,5 @@ export const voucherBeet = new beet.FixableBeetStruct< ['merkleTree', beetSolana.publicKey], ], Voucher.fromArgs, - 'Voucher', -); + 'Voucher' +) diff --git a/clients/js-solita/src/generated/accounts/index.ts b/clients/js-solita/src/generated/accounts/index.ts index d826f962..ee04d8f1 100644 --- a/clients/js-solita/src/generated/accounts/index.ts +++ b/clients/js-solita/src/generated/accounts/index.ts @@ -1,7 +1,7 @@ -export * from './TreeConfig'; -export * from './Voucher'; +export * from './TreeConfig' +export * from './Voucher' -import { TreeConfig } from './TreeConfig'; -import { Voucher } from './Voucher'; +import { TreeConfig } from './TreeConfig' +import { Voucher } from './Voucher' -export const accountProviders = { TreeConfig, Voucher }; +export const accountProviders = { TreeConfig, Voucher } diff --git a/clients/js-solita/src/generated/errors/index.ts b/clients/js-solita/src/generated/errors/index.ts index 2bd63848..918df6f2 100644 --- a/clients/js-solita/src/generated/errors/index.ts +++ b/clients/js-solita/src/generated/errors/index.ts @@ -5,11 +5,11 @@ * See: https://github.com/metaplex-foundation/solita */ -type ErrorWithCode = Error & { code: number }; -type MaybeErrorWithCode = ErrorWithCode | null | undefined; +type ErrorWithCode = Error & { code: number } +type MaybeErrorWithCode = ErrorWithCode | null | undefined -const createErrorFromCodeLookup: Map ErrorWithCode> = new Map(); -const createErrorFromNameLookup: Map ErrorWithCode> = new Map(); +const createErrorFromCodeLookup: Map ErrorWithCode> = new Map() +const createErrorFromNameLookup: Map ErrorWithCode> = new Map() /** * AssetOwnerMismatch: 'Asset Owner Does not match' @@ -18,18 +18,21 @@ const createErrorFromNameLookup: Map ErrorWithCode> = new Map(); * @category generated */ export class AssetOwnerMismatchError extends Error { - readonly code: number = 0x1770; - readonly name: string = 'AssetOwnerMismatch'; + readonly code: number = 0x1770 + readonly name: string = 'AssetOwnerMismatch' constructor() { - super('Asset Owner Does not match'); + super('Asset Owner Does not match') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, AssetOwnerMismatchError); + Error.captureStackTrace(this, AssetOwnerMismatchError) } } } -createErrorFromCodeLookup.set(0x1770, () => new AssetOwnerMismatchError()); -createErrorFromNameLookup.set('AssetOwnerMismatch', () => new AssetOwnerMismatchError()); +createErrorFromCodeLookup.set(0x1770, () => new AssetOwnerMismatchError()) +createErrorFromNameLookup.set( + 'AssetOwnerMismatch', + () => new AssetOwnerMismatchError() +) /** * PublicKeyMismatch: 'PublicKeyMismatch' @@ -38,18 +41,21 @@ createErrorFromNameLookup.set('AssetOwnerMismatch', () => new AssetOwnerMismatch * @category generated */ export class PublicKeyMismatchError extends Error { - readonly code: number = 0x1771; - readonly name: string = 'PublicKeyMismatch'; + readonly code: number = 0x1771 + readonly name: string = 'PublicKeyMismatch' constructor() { - super('PublicKeyMismatch'); + super('PublicKeyMismatch') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, PublicKeyMismatchError); + Error.captureStackTrace(this, PublicKeyMismatchError) } } } -createErrorFromCodeLookup.set(0x1771, () => new PublicKeyMismatchError()); -createErrorFromNameLookup.set('PublicKeyMismatch', () => new PublicKeyMismatchError()); +createErrorFromCodeLookup.set(0x1771, () => new PublicKeyMismatchError()) +createErrorFromNameLookup.set( + 'PublicKeyMismatch', + () => new PublicKeyMismatchError() +) /** * HashingMismatch: 'Hashing Mismatch Within Leaf Schema' @@ -58,18 +64,21 @@ createErrorFromNameLookup.set('PublicKeyMismatch', () => new PublicKeyMismatchEr * @category generated */ export class HashingMismatchError extends Error { - readonly code: number = 0x1772; - readonly name: string = 'HashingMismatch'; + readonly code: number = 0x1772 + readonly name: string = 'HashingMismatch' constructor() { - super('Hashing Mismatch Within Leaf Schema'); + super('Hashing Mismatch Within Leaf Schema') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, HashingMismatchError); + Error.captureStackTrace(this, HashingMismatchError) } } } -createErrorFromCodeLookup.set(0x1772, () => new HashingMismatchError()); -createErrorFromNameLookup.set('HashingMismatch', () => new HashingMismatchError()); +createErrorFromCodeLookup.set(0x1772, () => new HashingMismatchError()) +createErrorFromNameLookup.set( + 'HashingMismatch', + () => new HashingMismatchError() +) /** * UnsupportedSchemaVersion: 'Unsupported Schema Version' @@ -78,21 +87,21 @@ createErrorFromNameLookup.set('HashingMismatch', () => new HashingMismatchError( * @category generated */ export class UnsupportedSchemaVersionError extends Error { - readonly code: number = 0x1773; - readonly name: string = 'UnsupportedSchemaVersion'; + readonly code: number = 0x1773 + readonly name: string = 'UnsupportedSchemaVersion' constructor() { - super('Unsupported Schema Version'); + super('Unsupported Schema Version') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, UnsupportedSchemaVersionError); + Error.captureStackTrace(this, UnsupportedSchemaVersionError) } } } -createErrorFromCodeLookup.set(0x1773, () => new UnsupportedSchemaVersionError()); +createErrorFromCodeLookup.set(0x1773, () => new UnsupportedSchemaVersionError()) createErrorFromNameLookup.set( 'UnsupportedSchemaVersion', - () => new UnsupportedSchemaVersionError(), -); + () => new UnsupportedSchemaVersionError() +) /** * CreatorShareTotalMustBe100: 'Creator shares must sum to 100' @@ -101,21 +110,24 @@ createErrorFromNameLookup.set( * @category generated */ export class CreatorShareTotalMustBe100Error extends Error { - readonly code: number = 0x1774; - readonly name: string = 'CreatorShareTotalMustBe100'; + readonly code: number = 0x1774 + readonly name: string = 'CreatorShareTotalMustBe100' constructor() { - super('Creator shares must sum to 100'); + super('Creator shares must sum to 100') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorShareTotalMustBe100Error); + Error.captureStackTrace(this, CreatorShareTotalMustBe100Error) } } } -createErrorFromCodeLookup.set(0x1774, () => new CreatorShareTotalMustBe100Error()); +createErrorFromCodeLookup.set( + 0x1774, + () => new CreatorShareTotalMustBe100Error() +) createErrorFromNameLookup.set( 'CreatorShareTotalMustBe100', - () => new CreatorShareTotalMustBe100Error(), -); + () => new CreatorShareTotalMustBe100Error() +) /** * DuplicateCreatorAddress: 'No duplicate creator addresses in metadata' @@ -124,18 +136,21 @@ createErrorFromNameLookup.set( * @category generated */ export class DuplicateCreatorAddressError extends Error { - readonly code: number = 0x1775; - readonly name: string = 'DuplicateCreatorAddress'; + readonly code: number = 0x1775 + readonly name: string = 'DuplicateCreatorAddress' constructor() { - super('No duplicate creator addresses in metadata'); + super('No duplicate creator addresses in metadata') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, DuplicateCreatorAddressError); + Error.captureStackTrace(this, DuplicateCreatorAddressError) } } } -createErrorFromCodeLookup.set(0x1775, () => new DuplicateCreatorAddressError()); -createErrorFromNameLookup.set('DuplicateCreatorAddress', () => new DuplicateCreatorAddressError()); +createErrorFromCodeLookup.set(0x1775, () => new DuplicateCreatorAddressError()) +createErrorFromNameLookup.set( + 'DuplicateCreatorAddress', + () => new DuplicateCreatorAddressError() +) /** * CreatorDidNotVerify: 'Creator did not verify the metadata' @@ -144,18 +159,21 @@ createErrorFromNameLookup.set('DuplicateCreatorAddress', () => new DuplicateCrea * @category generated */ export class CreatorDidNotVerifyError extends Error { - readonly code: number = 0x1776; - readonly name: string = 'CreatorDidNotVerify'; + readonly code: number = 0x1776 + readonly name: string = 'CreatorDidNotVerify' constructor() { - super('Creator did not verify the metadata'); + super('Creator did not verify the metadata') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorDidNotVerifyError); + Error.captureStackTrace(this, CreatorDidNotVerifyError) } } } -createErrorFromCodeLookup.set(0x1776, () => new CreatorDidNotVerifyError()); -createErrorFromNameLookup.set('CreatorDidNotVerify', () => new CreatorDidNotVerifyError()); +createErrorFromCodeLookup.set(0x1776, () => new CreatorDidNotVerifyError()) +createErrorFromNameLookup.set( + 'CreatorDidNotVerify', + () => new CreatorDidNotVerifyError() +) /** * CreatorNotFound: 'Creator not found in creator Vec' @@ -164,18 +182,21 @@ createErrorFromNameLookup.set('CreatorDidNotVerify', () => new CreatorDidNotVeri * @category generated */ export class CreatorNotFoundError extends Error { - readonly code: number = 0x1777; - readonly name: string = 'CreatorNotFound'; + readonly code: number = 0x1777 + readonly name: string = 'CreatorNotFound' constructor() { - super('Creator not found in creator Vec'); + super('Creator not found in creator Vec') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorNotFoundError); + Error.captureStackTrace(this, CreatorNotFoundError) } } } -createErrorFromCodeLookup.set(0x1777, () => new CreatorNotFoundError()); -createErrorFromNameLookup.set('CreatorNotFound', () => new CreatorNotFoundError()); +createErrorFromCodeLookup.set(0x1777, () => new CreatorNotFoundError()) +createErrorFromNameLookup.set( + 'CreatorNotFound', + () => new CreatorNotFoundError() +) /** * NoCreatorsPresent: 'No creators in creator Vec' @@ -184,18 +205,21 @@ createErrorFromNameLookup.set('CreatorNotFound', () => new CreatorNotFoundError( * @category generated */ export class NoCreatorsPresentError extends Error { - readonly code: number = 0x1778; - readonly name: string = 'NoCreatorsPresent'; + readonly code: number = 0x1778 + readonly name: string = 'NoCreatorsPresent' constructor() { - super('No creators in creator Vec'); + super('No creators in creator Vec') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, NoCreatorsPresentError); + Error.captureStackTrace(this, NoCreatorsPresentError) } } } -createErrorFromCodeLookup.set(0x1778, () => new NoCreatorsPresentError()); -createErrorFromNameLookup.set('NoCreatorsPresent', () => new NoCreatorsPresentError()); +createErrorFromCodeLookup.set(0x1778, () => new NoCreatorsPresentError()) +createErrorFromNameLookup.set( + 'NoCreatorsPresent', + () => new NoCreatorsPresentError() +) /** * CreatorHashMismatch: 'User-provided creator Vec must result in same user-provided creator hash' @@ -204,18 +228,23 @@ createErrorFromNameLookup.set('NoCreatorsPresent', () => new NoCreatorsPresentEr * @category generated */ export class CreatorHashMismatchError extends Error { - readonly code: number = 0x1779; - readonly name: string = 'CreatorHashMismatch'; + readonly code: number = 0x1779 + readonly name: string = 'CreatorHashMismatch' constructor() { - super('User-provided creator Vec must result in same user-provided creator hash'); + super( + 'User-provided creator Vec must result in same user-provided creator hash' + ) if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorHashMismatchError); + Error.captureStackTrace(this, CreatorHashMismatchError) } } } -createErrorFromCodeLookup.set(0x1779, () => new CreatorHashMismatchError()); -createErrorFromNameLookup.set('CreatorHashMismatch', () => new CreatorHashMismatchError()); +createErrorFromCodeLookup.set(0x1779, () => new CreatorHashMismatchError()) +createErrorFromNameLookup.set( + 'CreatorHashMismatch', + () => new CreatorHashMismatchError() +) /** * DataHashMismatch: 'User-provided metadata must result in same user-provided data hash' @@ -224,18 +253,21 @@ createErrorFromNameLookup.set('CreatorHashMismatch', () => new CreatorHashMismat * @category generated */ export class DataHashMismatchError extends Error { - readonly code: number = 0x177a; - readonly name: string = 'DataHashMismatch'; + readonly code: number = 0x177a + readonly name: string = 'DataHashMismatch' constructor() { - super('User-provided metadata must result in same user-provided data hash'); + super('User-provided metadata must result in same user-provided data hash') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, DataHashMismatchError); + Error.captureStackTrace(this, DataHashMismatchError) } } } -createErrorFromCodeLookup.set(0x177a, () => new DataHashMismatchError()); -createErrorFromNameLookup.set('DataHashMismatch', () => new DataHashMismatchError()); +createErrorFromCodeLookup.set(0x177a, () => new DataHashMismatchError()) +createErrorFromNameLookup.set( + 'DataHashMismatch', + () => new DataHashMismatchError() +) /** * CreatorsTooLong: 'Creators list too long' @@ -244,18 +276,21 @@ createErrorFromNameLookup.set('DataHashMismatch', () => new DataHashMismatchErro * @category generated */ export class CreatorsTooLongError extends Error { - readonly code: number = 0x177b; - readonly name: string = 'CreatorsTooLong'; + readonly code: number = 0x177b + readonly name: string = 'CreatorsTooLong' constructor() { - super('Creators list too long'); + super('Creators list too long') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorsTooLongError); + Error.captureStackTrace(this, CreatorsTooLongError) } } } -createErrorFromCodeLookup.set(0x177b, () => new CreatorsTooLongError()); -createErrorFromNameLookup.set('CreatorsTooLong', () => new CreatorsTooLongError()); +createErrorFromCodeLookup.set(0x177b, () => new CreatorsTooLongError()) +createErrorFromNameLookup.set( + 'CreatorsTooLong', + () => new CreatorsTooLongError() +) /** * MetadataNameTooLong: 'Name in metadata is too long' @@ -264,18 +299,21 @@ createErrorFromNameLookup.set('CreatorsTooLong', () => new CreatorsTooLongError( * @category generated */ export class MetadataNameTooLongError extends Error { - readonly code: number = 0x177c; - readonly name: string = 'MetadataNameTooLong'; + readonly code: number = 0x177c + readonly name: string = 'MetadataNameTooLong' constructor() { - super('Name in metadata is too long'); + super('Name in metadata is too long') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataNameTooLongError); + Error.captureStackTrace(this, MetadataNameTooLongError) } } } -createErrorFromCodeLookup.set(0x177c, () => new MetadataNameTooLongError()); -createErrorFromNameLookup.set('MetadataNameTooLong', () => new MetadataNameTooLongError()); +createErrorFromCodeLookup.set(0x177c, () => new MetadataNameTooLongError()) +createErrorFromNameLookup.set( + 'MetadataNameTooLong', + () => new MetadataNameTooLongError() +) /** * MetadataSymbolTooLong: 'Symbol in metadata is too long' @@ -284,18 +322,21 @@ createErrorFromNameLookup.set('MetadataNameTooLong', () => new MetadataNameTooLo * @category generated */ export class MetadataSymbolTooLongError extends Error { - readonly code: number = 0x177d; - readonly name: string = 'MetadataSymbolTooLong'; + readonly code: number = 0x177d + readonly name: string = 'MetadataSymbolTooLong' constructor() { - super('Symbol in metadata is too long'); + super('Symbol in metadata is too long') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataSymbolTooLongError); + Error.captureStackTrace(this, MetadataSymbolTooLongError) } } } -createErrorFromCodeLookup.set(0x177d, () => new MetadataSymbolTooLongError()); -createErrorFromNameLookup.set('MetadataSymbolTooLong', () => new MetadataSymbolTooLongError()); +createErrorFromCodeLookup.set(0x177d, () => new MetadataSymbolTooLongError()) +createErrorFromNameLookup.set( + 'MetadataSymbolTooLong', + () => new MetadataSymbolTooLongError() +) /** * MetadataUriTooLong: 'Uri in metadata is too long' @@ -304,18 +345,21 @@ createErrorFromNameLookup.set('MetadataSymbolTooLong', () => new MetadataSymbolT * @category generated */ export class MetadataUriTooLongError extends Error { - readonly code: number = 0x177e; - readonly name: string = 'MetadataUriTooLong'; + readonly code: number = 0x177e + readonly name: string = 'MetadataUriTooLong' constructor() { - super('Uri in metadata is too long'); + super('Uri in metadata is too long') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataUriTooLongError); + Error.captureStackTrace(this, MetadataUriTooLongError) } } } -createErrorFromCodeLookup.set(0x177e, () => new MetadataUriTooLongError()); -createErrorFromNameLookup.set('MetadataUriTooLong', () => new MetadataUriTooLongError()); +createErrorFromCodeLookup.set(0x177e, () => new MetadataUriTooLongError()) +createErrorFromNameLookup.set( + 'MetadataUriTooLong', + () => new MetadataUriTooLongError() +) /** * MetadataBasisPointsTooHigh: 'Basis points in metadata cannot exceed 10000' @@ -324,21 +368,24 @@ createErrorFromNameLookup.set('MetadataUriTooLong', () => new MetadataUriTooLong * @category generated */ export class MetadataBasisPointsTooHighError extends Error { - readonly code: number = 0x177f; - readonly name: string = 'MetadataBasisPointsTooHigh'; + readonly code: number = 0x177f + readonly name: string = 'MetadataBasisPointsTooHigh' constructor() { - super('Basis points in metadata cannot exceed 10000'); + super('Basis points in metadata cannot exceed 10000') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataBasisPointsTooHighError); + Error.captureStackTrace(this, MetadataBasisPointsTooHighError) } } } -createErrorFromCodeLookup.set(0x177f, () => new MetadataBasisPointsTooHighError()); +createErrorFromCodeLookup.set( + 0x177f, + () => new MetadataBasisPointsTooHighError() +) createErrorFromNameLookup.set( 'MetadataBasisPointsTooHigh', - () => new MetadataBasisPointsTooHighError(), -); + () => new MetadataBasisPointsTooHighError() +) /** * TreeAuthorityIncorrect: 'Tree creator or tree delegate must sign.' @@ -347,18 +394,21 @@ createErrorFromNameLookup.set( * @category generated */ export class TreeAuthorityIncorrectError extends Error { - readonly code: number = 0x1780; - readonly name: string = 'TreeAuthorityIncorrect'; + readonly code: number = 0x1780 + readonly name: string = 'TreeAuthorityIncorrect' constructor() { - super('Tree creator or tree delegate must sign.'); + super('Tree creator or tree delegate must sign.') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, TreeAuthorityIncorrectError); + Error.captureStackTrace(this, TreeAuthorityIncorrectError) } } } -createErrorFromCodeLookup.set(0x1780, () => new TreeAuthorityIncorrectError()); -createErrorFromNameLookup.set('TreeAuthorityIncorrect', () => new TreeAuthorityIncorrectError()); +createErrorFromCodeLookup.set(0x1780, () => new TreeAuthorityIncorrectError()) +createErrorFromNameLookup.set( + 'TreeAuthorityIncorrect', + () => new TreeAuthorityIncorrectError() +) /** * InsufficientMintCapacity: 'Not enough unapproved mints left' @@ -367,21 +417,21 @@ createErrorFromNameLookup.set('TreeAuthorityIncorrect', () => new TreeAuthorityI * @category generated */ export class InsufficientMintCapacityError extends Error { - readonly code: number = 0x1781; - readonly name: string = 'InsufficientMintCapacity'; + readonly code: number = 0x1781 + readonly name: string = 'InsufficientMintCapacity' constructor() { - super('Not enough unapproved mints left'); + super('Not enough unapproved mints left') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InsufficientMintCapacityError); + Error.captureStackTrace(this, InsufficientMintCapacityError) } } } -createErrorFromCodeLookup.set(0x1781, () => new InsufficientMintCapacityError()); +createErrorFromCodeLookup.set(0x1781, () => new InsufficientMintCapacityError()) createErrorFromNameLookup.set( 'InsufficientMintCapacity', - () => new InsufficientMintCapacityError(), -); + () => new InsufficientMintCapacityError() +) /** * NumericalOverflowError: 'NumericalOverflowError' @@ -390,18 +440,21 @@ createErrorFromNameLookup.set( * @category generated */ export class NumericalOverflowErrorError extends Error { - readonly code: number = 0x1782; - readonly name: string = 'NumericalOverflowError'; + readonly code: number = 0x1782 + readonly name: string = 'NumericalOverflowError' constructor() { - super('NumericalOverflowError'); + super('NumericalOverflowError') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, NumericalOverflowErrorError); + Error.captureStackTrace(this, NumericalOverflowErrorError) } } } -createErrorFromCodeLookup.set(0x1782, () => new NumericalOverflowErrorError()); -createErrorFromNameLookup.set('NumericalOverflowError', () => new NumericalOverflowErrorError()); +createErrorFromCodeLookup.set(0x1782, () => new NumericalOverflowErrorError()) +createErrorFromNameLookup.set( + 'NumericalOverflowError', + () => new NumericalOverflowErrorError() +) /** * IncorrectOwner: 'Incorrect account owner' @@ -410,18 +463,18 @@ createErrorFromNameLookup.set('NumericalOverflowError', () => new NumericalOverf * @category generated */ export class IncorrectOwnerError extends Error { - readonly code: number = 0x1783; - readonly name: string = 'IncorrectOwner'; + readonly code: number = 0x1783 + readonly name: string = 'IncorrectOwner' constructor() { - super('Incorrect account owner'); + super('Incorrect account owner') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, IncorrectOwnerError); + Error.captureStackTrace(this, IncorrectOwnerError) } } } -createErrorFromCodeLookup.set(0x1783, () => new IncorrectOwnerError()); -createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError()); +createErrorFromCodeLookup.set(0x1783, () => new IncorrectOwnerError()) +createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError()) /** * CollectionCannotBeVerifiedInThisInstruction: 'Cannot Verify Collection in this Instruction' @@ -430,21 +483,27 @@ createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError()) * @category generated */ export class CollectionCannotBeVerifiedInThisInstructionError extends Error { - readonly code: number = 0x1784; - readonly name: string = 'CollectionCannotBeVerifiedInThisInstruction'; + readonly code: number = 0x1784 + readonly name: string = 'CollectionCannotBeVerifiedInThisInstruction' constructor() { - super('Cannot Verify Collection in this Instruction'); + super('Cannot Verify Collection in this Instruction') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CollectionCannotBeVerifiedInThisInstructionError); + Error.captureStackTrace( + this, + CollectionCannotBeVerifiedInThisInstructionError + ) } } } -createErrorFromCodeLookup.set(0x1784, () => new CollectionCannotBeVerifiedInThisInstructionError()); +createErrorFromCodeLookup.set( + 0x1784, + () => new CollectionCannotBeVerifiedInThisInstructionError() +) createErrorFromNameLookup.set( 'CollectionCannotBeVerifiedInThisInstruction', - () => new CollectionCannotBeVerifiedInThisInstructionError(), -); + () => new CollectionCannotBeVerifiedInThisInstructionError() +) /** * CollectionNotFound: 'Collection Not Found on Metadata' @@ -453,18 +512,21 @@ createErrorFromNameLookup.set( * @category generated */ export class CollectionNotFoundError extends Error { - readonly code: number = 0x1785; - readonly name: string = 'CollectionNotFound'; + readonly code: number = 0x1785 + readonly name: string = 'CollectionNotFound' constructor() { - super('Collection Not Found on Metadata'); + super('Collection Not Found on Metadata') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CollectionNotFoundError); + Error.captureStackTrace(this, CollectionNotFoundError) } } } -createErrorFromCodeLookup.set(0x1785, () => new CollectionNotFoundError()); -createErrorFromNameLookup.set('CollectionNotFound', () => new CollectionNotFoundError()); +createErrorFromCodeLookup.set(0x1785, () => new CollectionNotFoundError()) +createErrorFromNameLookup.set( + 'CollectionNotFound', + () => new CollectionNotFoundError() +) /** * AlreadyVerified: 'Collection item is already verified.' @@ -473,18 +535,21 @@ createErrorFromNameLookup.set('CollectionNotFound', () => new CollectionNotFound * @category generated */ export class AlreadyVerifiedError extends Error { - readonly code: number = 0x1786; - readonly name: string = 'AlreadyVerified'; + readonly code: number = 0x1786 + readonly name: string = 'AlreadyVerified' constructor() { - super('Collection item is already verified.'); + super('Collection item is already verified.') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, AlreadyVerifiedError); + Error.captureStackTrace(this, AlreadyVerifiedError) } } } -createErrorFromCodeLookup.set(0x1786, () => new AlreadyVerifiedError()); -createErrorFromNameLookup.set('AlreadyVerified', () => new AlreadyVerifiedError()); +createErrorFromCodeLookup.set(0x1786, () => new AlreadyVerifiedError()) +createErrorFromNameLookup.set( + 'AlreadyVerified', + () => new AlreadyVerifiedError() +) /** * AlreadyUnverified: 'Collection item is already unverified.' @@ -493,18 +558,21 @@ createErrorFromNameLookup.set('AlreadyVerified', () => new AlreadyVerifiedError( * @category generated */ export class AlreadyUnverifiedError extends Error { - readonly code: number = 0x1787; - readonly name: string = 'AlreadyUnverified'; + readonly code: number = 0x1787 + readonly name: string = 'AlreadyUnverified' constructor() { - super('Collection item is already unverified.'); + super('Collection item is already unverified.') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, AlreadyUnverifiedError); + Error.captureStackTrace(this, AlreadyUnverifiedError) } } } -createErrorFromCodeLookup.set(0x1787, () => new AlreadyUnverifiedError()); -createErrorFromNameLookup.set('AlreadyUnverified', () => new AlreadyUnverifiedError()); +createErrorFromCodeLookup.set(0x1787, () => new AlreadyUnverifiedError()) +createErrorFromNameLookup.set( + 'AlreadyUnverified', + () => new AlreadyUnverifiedError() +) /** * UpdateAuthorityIncorrect: 'Incorrect leaf metadata update authority.' @@ -513,21 +581,21 @@ createErrorFromNameLookup.set('AlreadyUnverified', () => new AlreadyUnverifiedEr * @category generated */ export class UpdateAuthorityIncorrectError extends Error { - readonly code: number = 0x1788; - readonly name: string = 'UpdateAuthorityIncorrect'; + readonly code: number = 0x1788 + readonly name: string = 'UpdateAuthorityIncorrect' constructor() { - super('Incorrect leaf metadata update authority.'); + super('Incorrect leaf metadata update authority.') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, UpdateAuthorityIncorrectError); + Error.captureStackTrace(this, UpdateAuthorityIncorrectError) } } } -createErrorFromCodeLookup.set(0x1788, () => new UpdateAuthorityIncorrectError()); +createErrorFromCodeLookup.set(0x1788, () => new UpdateAuthorityIncorrectError()) createErrorFromNameLookup.set( 'UpdateAuthorityIncorrect', - () => new UpdateAuthorityIncorrectError(), -); + () => new UpdateAuthorityIncorrectError() +) /** * LeafAuthorityMustSign: 'This transaction must be signed by either the leaf owner or leaf delegate' @@ -536,18 +604,23 @@ createErrorFromNameLookup.set( * @category generated */ export class LeafAuthorityMustSignError extends Error { - readonly code: number = 0x1789; - readonly name: string = 'LeafAuthorityMustSign'; + readonly code: number = 0x1789 + readonly name: string = 'LeafAuthorityMustSign' constructor() { - super('This transaction must be signed by either the leaf owner or leaf delegate'); + super( + 'This transaction must be signed by either the leaf owner or leaf delegate' + ) if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, LeafAuthorityMustSignError); + Error.captureStackTrace(this, LeafAuthorityMustSignError) } } } -createErrorFromCodeLookup.set(0x1789, () => new LeafAuthorityMustSignError()); -createErrorFromNameLookup.set('LeafAuthorityMustSign', () => new LeafAuthorityMustSignError()); +createErrorFromCodeLookup.set(0x1789, () => new LeafAuthorityMustSignError()) +createErrorFromNameLookup.set( + 'LeafAuthorityMustSign', + () => new LeafAuthorityMustSignError() +) /** * CollectionMustBeSized: 'Collection Not Compatable with Compression, Must be Sized' @@ -556,18 +629,136 @@ createErrorFromNameLookup.set('LeafAuthorityMustSign', () => new LeafAuthorityMu * @category generated */ export class CollectionMustBeSizedError extends Error { - readonly code: number = 0x178a; - readonly name: string = 'CollectionMustBeSized'; + readonly code: number = 0x178a + readonly name: string = 'CollectionMustBeSized' constructor() { - super('Collection Not Compatable with Compression, Must be Sized'); + super('Collection Not Compatable with Compression, Must be Sized') if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CollectionMustBeSizedError); + Error.captureStackTrace(this, CollectionMustBeSizedError) } } } -createErrorFromCodeLookup.set(0x178a, () => new CollectionMustBeSizedError()); -createErrorFromNameLookup.set('CollectionMustBeSized', () => new CollectionMustBeSizedError()); +createErrorFromCodeLookup.set(0x178a, () => new CollectionMustBeSizedError()) +createErrorFromNameLookup.set( + 'CollectionMustBeSized', + () => new CollectionMustBeSizedError() +) + +/** + * MetadataImmutable: 'Metadata Not Mutable' + * + * @category Errors + * @category generated + */ +export class MetadataImmutableError extends Error { + readonly code: number = 0x178b + readonly name: string = 'MetadataImmutable' + constructor() { + super('Metadata Not Mutable') + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, MetadataImmutableError) + } + } +} + +createErrorFromCodeLookup.set(0x178b, () => new MetadataImmutableError()) +createErrorFromNameLookup.set( + 'MetadataImmutable', + () => new MetadataImmutableError() +) + +/** + * CollectionMismatch: 'Collection mismatch' + * + * @category Errors + * @category generated + */ +export class CollectionMismatchError extends Error { + readonly code: number = 0x178c + readonly name: string = 'CollectionMismatch' + constructor() { + super('Collection mismatch') + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, CollectionMismatchError) + } + } +} + +createErrorFromCodeLookup.set(0x178c, () => new CollectionMismatchError()) +createErrorFromNameLookup.set( + 'CollectionMismatch', + () => new CollectionMismatchError() +) + +/** + * MetadataArgsAmbiguous: 'MetadataArgs Ambiguous' + * + * @category Errors + * @category generated + */ +export class MetadataArgsAmbiguousError extends Error { + readonly code: number = 0x178d + readonly name: string = 'MetadataArgsAmbiguous' + constructor() { + super('MetadataArgs Ambiguous') + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, MetadataArgsAmbiguousError) + } + } +} + +createErrorFromCodeLookup.set(0x178d, () => new MetadataArgsAmbiguousError()) +createErrorFromNameLookup.set( + 'MetadataArgsAmbiguous', + () => new MetadataArgsAmbiguousError() +) + +/** + * MetadataArgsMissing: 'MetadataArgs Missing' + * + * @category Errors + * @category generated + */ +export class MetadataArgsMissingError extends Error { + readonly code: number = 0x178e + readonly name: string = 'MetadataArgsMissing' + constructor() { + super('MetadataArgs Missing') + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, MetadataArgsMissingError) + } + } +} + +createErrorFromCodeLookup.set(0x178e, () => new MetadataArgsMissingError()) +createErrorFromNameLookup.set( + 'MetadataArgsMissing', + () => new MetadataArgsMissingError() +) + +/** + * NFTLinkedToCollection: 'NFT linked to collection' + * + * @category Errors + * @category generated + */ +export class NFTLinkedToCollectionError extends Error { + readonly code: number = 0x178f + readonly name: string = 'NFTLinkedToCollection' + constructor() { + super('NFT linked to collection') + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, NFTLinkedToCollectionError) + } + } +} + +createErrorFromCodeLookup.set(0x178f, () => new NFTLinkedToCollectionError()) +createErrorFromNameLookup.set( + 'NFTLinkedToCollection', + () => new NFTLinkedToCollectionError() +) /** * MetadataMintMismatch: 'Metadata mint does not match collection mint' @@ -724,8 +915,8 @@ createErrorFromNameLookup.set('DecompressionDisabled', () => new DecompressionDi * @category generated */ export function errorFromCode(code: number): MaybeErrorWithCode { - const createError = createErrorFromCodeLookup.get(code); - return createError != null ? createError() : null; + const createError = createErrorFromCodeLookup.get(code) + return createError != null ? createError() : null } /** @@ -734,6 +925,6 @@ export function errorFromCode(code: number): MaybeErrorWithCode { * @category generated */ export function errorFromName(name: string): MaybeErrorWithCode { - const createError = createErrorFromNameLookup.get(name); - return createError != null ? createError() : null; + const createError = createErrorFromNameLookup.get(name) + return createError != null ? createError() : null } diff --git a/clients/js-solita/src/generated/index.ts b/clients/js-solita/src/generated/index.ts index b8817cae..d153d4d5 100644 --- a/clients/js-solita/src/generated/index.ts +++ b/clients/js-solita/src/generated/index.ts @@ -1,8 +1,8 @@ -import { PublicKey } from '@solana/web3.js'; -export * from './accounts'; -export * from './errors'; -export * from './instructions'; -export * from './types'; +import { PublicKey } from '@solana/web3.js' +export * from './accounts' +export * from './errors' +export * from './instructions' +export * from './types' /** * Program address @@ -10,7 +10,7 @@ export * from './types'; * @category constants * @category generated */ -export const PROGRAM_ADDRESS = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'; +export const PROGRAM_ADDRESS = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' /** * Program public key @@ -18,4 +18,4 @@ export const PROGRAM_ADDRESS = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'; * @category constants * @category generated */ -export const PROGRAM_ID = new PublicKey(PROGRAM_ADDRESS); +export const PROGRAM_ID = new PublicKey(PROGRAM_ADDRESS) diff --git a/clients/js-solita/src/generated/instructions/burn.ts b/clients/js-solita/src/generated/instructions/burn.ts index 3bb9adb4..1ecbab45 100644 --- a/clients/js-solita/src/generated/instructions/burn.ts +++ b/clients/js-solita/src/generated/instructions/burn.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export type BurnInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number +} /** * @category Instructions * @category Burn @@ -27,7 +27,7 @@ export type BurnInstructionArgs = { */ export const burnStruct = new beet.BeetArgsStruct< BurnInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -38,8 +38,8 @@ export const burnStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'BurnInstructionArgs', -); + 'BurnInstructionArgs' +) /** * Accounts required by the _burn_ instruction * @@ -54,17 +54,17 @@ export const burnStruct = new beet.BeetArgsStruct< * @category generated */ export type BurnInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const burnInstructionDiscriminator = [116, 110, 29, 56, 107, 219, 42, 93]; +export const burnInstructionDiscriminator = [116, 110, 29, 56, 107, 219, 42, 93] /** * Creates a _Burn_ instruction. @@ -79,12 +79,12 @@ export const burnInstructionDiscriminator = [116, 110, 29, 56, 107, 219, 42, 93] export function createBurnInstruction( accounts: BurnInstructionAccounts, args: BurnInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = burnStruct.serialize({ instructionDiscriminator: burnInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -121,11 +121,11 @@ export function createBurnInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -133,6 +133,6 @@ export function createBurnInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/cancelRedeem.ts b/clients/js-solita/src/generated/instructions/cancelRedeem.ts index 875fad85..37479340 100644 --- a/clients/js-solita/src/generated/instructions/cancelRedeem.ts +++ b/clients/js-solita/src/generated/instructions/cancelRedeem.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,8 +14,8 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export type CancelRedeemInstructionArgs = { - root: number[] /* size: 32 */; -}; + root: number[] /* size: 32 */ +} /** * @category Instructions * @category CancelRedeem @@ -23,15 +23,15 @@ export type CancelRedeemInstructionArgs = { */ export const cancelRedeemStruct = new beet.BeetArgsStruct< CancelRedeemInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['root', beet.uniformFixedSizeArray(beet.u8, 32)], ], - 'CancelRedeemInstructionArgs', -); + 'CancelRedeemInstructionArgs' +) /** * Accounts required by the _cancelRedeem_ instruction * @@ -46,17 +46,19 @@ export const cancelRedeemStruct = new beet.BeetArgsStruct< * @category generated */ export type CancelRedeemInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - merkleTree: web3.PublicKey; - voucher: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + merkleTree: web3.PublicKey + voucher: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const cancelRedeemInstructionDiscriminator = [111, 76, 232, 50, 39, 175, 48, 242]; +export const cancelRedeemInstructionDiscriminator = [ + 111, 76, 232, 50, 39, 175, 48, 242, +] /** * Creates a _CancelRedeem_ instruction. @@ -71,12 +73,12 @@ export const cancelRedeemInstructionDiscriminator = [111, 76, 232, 50, 39, 175, export function createCancelRedeemInstruction( accounts: CancelRedeemInstructionAccounts, args: CancelRedeemInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = cancelRedeemStruct.serialize({ instructionDiscriminator: cancelRedeemInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -113,11 +115,11 @@ export function createCancelRedeemInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -125,6 +127,6 @@ export function createCancelRedeemInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/compress.ts b/clients/js-solita/src/generated/instructions/compress.ts index 69e301b4..8265cdef 100644 --- a/clients/js-solita/src/generated/instructions/compress.ts +++ b/clients/js-solita/src/generated/instructions/compress.ts @@ -5,9 +5,9 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as splToken from '@solana/spl-token'; -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as splToken from '@solana/spl-token' +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -15,11 +15,11 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export const compressStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ }>( [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CompressInstructionArgs', -); + 'CompressInstructionArgs' +) /** * Accounts required by the _compress_ instruction * @@ -40,24 +40,26 @@ export const compressStruct = new beet.BeetArgsStruct<{ * @category generated */ export type CompressInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - tokenAccount: web3.PublicKey; - mint: web3.PublicKey; - metadata: web3.PublicKey; - masterEdition: web3.PublicKey; - payer: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - tokenProgram?: web3.PublicKey; - tokenMetadataProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + tokenAccount: web3.PublicKey + mint: web3.PublicKey + metadata: web3.PublicKey + masterEdition: web3.PublicKey + payer: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenProgram?: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const compressInstructionDiscriminator = [82, 193, 176, 117, 176, 21, 115, 253]; +export const compressInstructionDiscriminator = [ + 82, 193, 176, 117, 176, 21, 115, 253, +] /** * Creates a _Compress_ instruction. @@ -69,11 +71,11 @@ export const compressInstructionDiscriminator = [82, 193, 176, 117, 176, 21, 115 */ export function createCompressInstruction( accounts: CompressInstructionAccounts, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = compressStruct.serialize({ instructionDiscriminator: compressInstructionDiscriminator, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -145,11 +147,11 @@ export function createCompressInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -157,6 +159,6 @@ export function createCompressInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/createTree.ts b/clients/js-solita/src/generated/instructions/createTree.ts index 0534051f..2bc1d49f 100644 --- a/clients/js-solita/src/generated/instructions/createTree.ts +++ b/clients/js-solita/src/generated/instructions/createTree.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,10 +14,10 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export type CreateTreeInstructionArgs = { - maxDepth: number; - maxBufferSize: number; - public: beet.COption; -}; + maxDepth: number + maxBufferSize: number + public: beet.COption +} /** * @category Instructions * @category CreateTree @@ -25,7 +25,7 @@ export type CreateTreeInstructionArgs = { */ export const createTreeStruct = new beet.FixableBeetArgsStruct< CreateTreeInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -34,8 +34,8 @@ export const createTreeStruct = new beet.FixableBeetArgsStruct< ['maxBufferSize', beet.u32], ['public', beet.coption(beet.bool)], ], - 'CreateTreeInstructionArgs', -); + 'CreateTreeInstructionArgs' +) /** * Accounts required by the _createTree_ instruction * @@ -50,17 +50,19 @@ export const createTreeStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type CreateTreeInstructionAccounts = { - treeAuthority: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - treeCreator: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + treeCreator: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const createTreeInstructionDiscriminator = [165, 83, 136, 142, 89, 202, 47, 220]; +export const createTreeInstructionDiscriminator = [ + 165, 83, 136, 142, 89, 202, 47, 220, +] /** * Creates a _CreateTree_ instruction. @@ -75,12 +77,12 @@ export const createTreeInstructionDiscriminator = [165, 83, 136, 142, 89, 202, 4 export function createCreateTreeInstruction( accounts: CreateTreeInstructionAccounts, args: CreateTreeInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = createTreeStruct.serialize({ instructionDiscriminator: createTreeInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -117,11 +119,11 @@ export function createCreateTreeInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -129,6 +131,6 @@ export function createCreateTreeInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/decompressV1.ts b/clients/js-solita/src/generated/instructions/decompressV1.ts index a090d580..e2887975 100644 --- a/clients/js-solita/src/generated/instructions/decompressV1.ts +++ b/clients/js-solita/src/generated/instructions/decompressV1.ts @@ -5,10 +5,10 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as splToken from '@solana/spl-token'; -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; -import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; +import * as splToken from '@solana/spl-token' +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -16,8 +16,8 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type DecompressV1InstructionArgs = { - metadata: MetadataArgs; -}; + metadata: MetadataArgs +} /** * @category Instructions * @category DecompressV1 @@ -25,15 +25,15 @@ export type DecompressV1InstructionArgs = { */ export const decompressV1Struct = new beet.FixableBeetArgsStruct< DecompressV1InstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['metadata', metadataArgsBeet], ], - 'DecompressV1InstructionArgs', -); + 'DecompressV1InstructionArgs' +) /** * Accounts required by the _decompressV1_ instruction * @@ -53,23 +53,25 @@ export const decompressV1Struct = new beet.FixableBeetArgsStruct< * @category generated */ export type DecompressV1InstructionAccounts = { - voucher: web3.PublicKey; - leafOwner: web3.PublicKey; - tokenAccount: web3.PublicKey; - mint: web3.PublicKey; - mintAuthority: web3.PublicKey; - metadata: web3.PublicKey; - masterEdition: web3.PublicKey; - systemProgram?: web3.PublicKey; - sysvarRent: web3.PublicKey; - tokenMetadataProgram: web3.PublicKey; - tokenProgram?: web3.PublicKey; - associatedTokenProgram: web3.PublicKey; - logWrapper: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + voucher: web3.PublicKey + leafOwner: web3.PublicKey + tokenAccount: web3.PublicKey + mint: web3.PublicKey + mintAuthority: web3.PublicKey + metadata: web3.PublicKey + masterEdition: web3.PublicKey + systemProgram?: web3.PublicKey + sysvarRent: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + tokenProgram?: web3.PublicKey + associatedTokenProgram: web3.PublicKey + logWrapper: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const decompressV1InstructionDiscriminator = [54, 85, 76, 70, 228, 250, 164, 81]; +export const decompressV1InstructionDiscriminator = [ + 54, 85, 76, 70, 228, 250, 164, 81, +] /** * Creates a _DecompressV1_ instruction. @@ -84,12 +86,12 @@ export const decompressV1InstructionDiscriminator = [54, 85, 76, 70, 228, 250, 1 export function createDecompressV1Instruction( accounts: DecompressV1InstructionAccounts, args: DecompressV1InstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = decompressV1Struct.serialize({ instructionDiscriminator: decompressV1InstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.voucher, @@ -156,11 +158,11 @@ export function createDecompressV1Instruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -168,6 +170,6 @@ export function createDecompressV1Instruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/delegate.ts b/clients/js-solita/src/generated/instructions/delegate.ts index a59a35a2..c4341c89 100644 --- a/clients/js-solita/src/generated/instructions/delegate.ts +++ b/clients/js-solita/src/generated/instructions/delegate.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export type DelegateInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number +} /** * @category Instructions * @category Delegate @@ -27,7 +27,7 @@ export type DelegateInstructionArgs = { */ export const delegateStruct = new beet.BeetArgsStruct< DelegateInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -38,8 +38,8 @@ export const delegateStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'DelegateInstructionArgs', -); + 'DelegateInstructionArgs' +) /** * Accounts required by the _delegate_ instruction * @@ -55,18 +55,20 @@ export const delegateStruct = new beet.BeetArgsStruct< * @category generated */ export type DelegateInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - previousLeafDelegate: web3.PublicKey; - newLeafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + previousLeafDelegate: web3.PublicKey + newLeafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const delegateInstructionDiscriminator = [90, 147, 75, 178, 85, 88, 4, 137]; +export const delegateInstructionDiscriminator = [ + 90, 147, 75, 178, 85, 88, 4, 137, +] /** * Creates a _Delegate_ instruction. @@ -81,12 +83,12 @@ export const delegateInstructionDiscriminator = [90, 147, 75, 178, 85, 88, 4, 13 export function createDelegateInstruction( accounts: DelegateInstructionAccounts, args: DelegateInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = delegateStruct.serialize({ instructionDiscriminator: delegateInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -128,11 +130,11 @@ export function createDelegateInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -140,6 +142,6 @@ export function createDelegateInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/index.ts b/clients/js-solita/src/generated/instructions/index.ts index 72604411..142057f9 100644 --- a/clients/js-solita/src/generated/instructions/index.ts +++ b/clients/js-solita/src/generated/instructions/index.ts @@ -13,5 +13,7 @@ export * from './setTreeDelegate'; export * from './transfer'; export * from './unverifyCollection'; export * from './unverifyCreator'; +export * from './updateMetadata' +export * from './updateMetadataCollectionNft' export * from './verifyCollection'; export * from './verifyCreator'; diff --git a/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts b/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts index fd27b155..80aba2af 100644 --- a/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts +++ b/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts @@ -5,9 +5,9 @@ * 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'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -15,8 +15,8 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type MintToCollectionV1InstructionArgs = { - metadataArgs: MetadataArgs; -}; + metadataArgs: MetadataArgs +} /** * @category Instructions * @category MintToCollectionV1 @@ -24,15 +24,15 @@ export type MintToCollectionV1InstructionArgs = { */ export const mintToCollectionV1Struct = new beet.FixableBeetArgsStruct< MintToCollectionV1InstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['metadataArgs', metadataArgsBeet], ], - 'MintToCollectionV1InstructionArgs', -); + 'MintToCollectionV1InstructionArgs' +) /** * Accounts required by the _mintToCollectionV1_ instruction * @@ -56,26 +56,28 @@ export const mintToCollectionV1Struct = new beet.FixableBeetArgsStruct< * @category generated */ export type MintToCollectionV1InstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - treeDelegate: web3.PublicKey; - collectionAuthority: web3.PublicKey; - collectionAuthorityRecordPda: web3.PublicKey; - collectionMint: web3.PublicKey; - collectionMetadata: web3.PublicKey; - editionAccount: web3.PublicKey; - bubblegumSigner: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - tokenMetadataProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + treeDelegate: web3.PublicKey + collectionAuthority: web3.PublicKey + collectionAuthorityRecordPda: web3.PublicKey + collectionMint: web3.PublicKey + collectionMetadata: web3.PublicKey + editionAccount: web3.PublicKey + bubblegumSigner: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const mintToCollectionV1InstructionDiscriminator = [153, 18, 178, 47, 197, 158, 86, 15]; +export const mintToCollectionV1InstructionDiscriminator = [ + 153, 18, 178, 47, 197, 158, 86, 15, +] /** * Creates a _MintToCollectionV1_ instruction. @@ -90,12 +92,12 @@ export const mintToCollectionV1InstructionDiscriminator = [153, 18, 178, 47, 197 export function createMintToCollectionV1Instruction( accounts: MintToCollectionV1InstructionAccounts, args: MintToCollectionV1InstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = mintToCollectionV1Struct.serialize({ instructionDiscriminator: mintToCollectionV1InstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -177,11 +179,11 @@ export function createMintToCollectionV1Instruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -189,6 +191,6 @@ export function createMintToCollectionV1Instruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/mintV1.ts b/clients/js-solita/src/generated/instructions/mintV1.ts index 1a737897..f54c8cac 100644 --- a/clients/js-solita/src/generated/instructions/mintV1.ts +++ b/clients/js-solita/src/generated/instructions/mintV1.ts @@ -5,9 +5,9 @@ * 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'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -15,8 +15,8 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type MintV1InstructionArgs = { - message: MetadataArgs; -}; + message: MetadataArgs +} /** * @category Instructions * @category MintV1 @@ -24,15 +24,15 @@ export type MintV1InstructionArgs = { */ export const mintV1Struct = new beet.FixableBeetArgsStruct< MintV1InstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['message', metadataArgsBeet], ], - 'MintV1InstructionArgs', -); + 'MintV1InstructionArgs' +) /** * Accounts required by the _mintV1_ instruction * @@ -49,19 +49,21 @@ export const mintV1Struct = new beet.FixableBeetArgsStruct< * @category generated */ export type MintV1InstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - treeDelegate: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + treeDelegate: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const mintV1InstructionDiscriminator = [145, 98, 192, 118, 184, 147, 118, 104]; +export const mintV1InstructionDiscriminator = [ + 145, 98, 192, 118, 184, 147, 118, 104, +] /** * Creates a _MintV1_ instruction. @@ -76,12 +78,12 @@ export const mintV1InstructionDiscriminator = [145, 98, 192, 118, 184, 147, 118, export function createMintV1Instruction( accounts: MintV1InstructionAccounts, args: MintV1InstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = mintV1Struct.serialize({ instructionDiscriminator: mintV1InstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -128,11 +130,11 @@ export function createMintV1Instruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -140,6 +142,6 @@ export function createMintV1Instruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/redeem.ts b/clients/js-solita/src/generated/instructions/redeem.ts index c4f82e4c..28bd12bc 100644 --- a/clients/js-solita/src/generated/instructions/redeem.ts +++ b/clients/js-solita/src/generated/instructions/redeem.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export type RedeemInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number +} /** * @category Instructions * @category Redeem @@ -27,7 +27,7 @@ export type RedeemInstructionArgs = { */ export const redeemStruct = new beet.BeetArgsStruct< RedeemInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -38,8 +38,8 @@ export const redeemStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'RedeemInstructionArgs', -); + 'RedeemInstructionArgs' +) /** * Accounts required by the _redeem_ instruction * @@ -55,18 +55,20 @@ export const redeemStruct = new beet.BeetArgsStruct< * @category generated */ export type RedeemInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - voucher: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + voucher: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const redeemInstructionDiscriminator = [184, 12, 86, 149, 70, 196, 97, 225]; +export const redeemInstructionDiscriminator = [ + 184, 12, 86, 149, 70, 196, 97, 225, +] /** * Creates a _Redeem_ instruction. @@ -81,12 +83,12 @@ export const redeemInstructionDiscriminator = [184, 12, 86, 149, 70, 196, 97, 22 export function createRedeemInstruction( accounts: RedeemInstructionAccounts, args: RedeemInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = redeemStruct.serialize({ instructionDiscriminator: redeemInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -128,11 +130,11 @@ export function createRedeemInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -140,6 +142,6 @@ export function createRedeemInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts b/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts index 48cd8287..240d91e4 100644 --- a/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts +++ b/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts @@ -5,10 +5,10 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; -import * as beetSolana from '@metaplex-foundation/beet-solana'; -import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import * as beetSolana from '@metaplex-foundation/beet-solana' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -16,14 +16,14 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @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: web3.PublicKey; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number + message: MetadataArgs + collection: web3.PublicKey +} /** * @category Instructions * @category SetAndVerifyCollection @@ -31,7 +31,7 @@ export type SetAndVerifyCollectionInstructionArgs = { */ export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct< SetAndVerifyCollectionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -44,8 +44,8 @@ export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct< ['message', metadataArgsBeet], ['collection', beetSolana.publicKey], ], - 'SetAndVerifyCollectionInstructionArgs', -); + 'SetAndVerifyCollectionInstructionArgs' +) /** * Accounts required by the _setAndVerifyCollection_ instruction * @@ -69,28 +69,28 @@ export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type SetAndVerifyCollectionInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - treeDelegate: web3.PublicKey; - collectionAuthority: web3.PublicKey; - collectionAuthorityRecordPda: web3.PublicKey; - collectionMint: web3.PublicKey; - collectionMetadata: web3.PublicKey; - editionAccount: web3.PublicKey; - bubblegumSigner: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - tokenMetadataProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + treeDelegate: web3.PublicKey + collectionAuthority: web3.PublicKey + collectionAuthorityRecordPda: web3.PublicKey + collectionMint: web3.PublicKey + collectionMetadata: web3.PublicKey + editionAccount: web3.PublicKey + bubblegumSigner: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} export const setAndVerifyCollectionInstructionDiscriminator = [ 235, 242, 121, 216, 158, 234, 180, 234, -]; +] /** * Creates a _SetAndVerifyCollection_ instruction. @@ -105,12 +105,12 @@ export const setAndVerifyCollectionInstructionDiscriminator = [ export function createSetAndVerifyCollectionInstruction( accounts: SetAndVerifyCollectionInstructionAccounts, args: SetAndVerifyCollectionInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = setAndVerifyCollectionStruct.serialize({ instructionDiscriminator: setAndVerifyCollectionInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -192,11 +192,11 @@ export function createSetAndVerifyCollectionInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -204,6 +204,6 @@ export function createSetAndVerifyCollectionInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/setTreeDelegate.ts b/clients/js-solita/src/generated/instructions/setTreeDelegate.ts index c53d3f88..eae00152 100644 --- a/clients/js-solita/src/generated/instructions/setTreeDelegate.ts +++ b/clients/js-solita/src/generated/instructions/setTreeDelegate.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,11 +14,11 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export const setTreeDelegateStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ }>( [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'SetTreeDelegateInstructionArgs', -); + 'SetTreeDelegateInstructionArgs' +) /** * Accounts required by the _setTreeDelegate_ instruction * @@ -31,15 +31,17 @@ export const setTreeDelegateStruct = new beet.BeetArgsStruct<{ * @category generated */ export type SetTreeDelegateInstructionAccounts = { - treeAuthority: web3.PublicKey; - treeCreator: web3.PublicKey; - newTreeDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + treeCreator: web3.PublicKey + newTreeDelegate: web3.PublicKey + merkleTree: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const setTreeDelegateInstructionDiscriminator = [253, 118, 66, 37, 190, 49, 154, 102]; +export const setTreeDelegateInstructionDiscriminator = [ + 253, 118, 66, 37, 190, 49, 154, 102, +] /** * Creates a _SetTreeDelegate_ instruction. @@ -51,11 +53,11 @@ export const setTreeDelegateInstructionDiscriminator = [253, 118, 66, 37, 190, 4 */ export function createSetTreeDelegateInstruction( accounts: SetTreeDelegateInstructionAccounts, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = setTreeDelegateStruct.serialize({ instructionDiscriminator: setTreeDelegateInstructionDiscriminator, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -82,11 +84,11 @@ export function createSetTreeDelegateInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -94,6 +96,6 @@ export function createSetTreeDelegateInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/transfer.ts b/clients/js-solita/src/generated/instructions/transfer.ts index d43d4301..b6f919b7 100644 --- a/clients/js-solita/src/generated/instructions/transfer.ts +++ b/clients/js-solita/src/generated/instructions/transfer.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js'; * @category generated */ export type TransferInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number +} /** * @category Instructions * @category Transfer @@ -27,7 +27,7 @@ export type TransferInstructionArgs = { */ export const transferStruct = new beet.BeetArgsStruct< TransferInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -38,8 +38,8 @@ export const transferStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'TransferInstructionArgs', -); + 'TransferInstructionArgs' +) /** * Accounts required by the _transfer_ instruction * @@ -55,18 +55,20 @@ export const transferStruct = new beet.BeetArgsStruct< * @category generated */ export type TransferInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - newLeafOwner: web3.PublicKey; - merkleTree: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + newLeafOwner: web3.PublicKey + merkleTree: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const transferInstructionDiscriminator = [163, 52, 200, 231, 140, 3, 69, 186]; +export const transferInstructionDiscriminator = [ + 163, 52, 200, 231, 140, 3, 69, 186, +] /** * Creates a _Transfer_ instruction. @@ -81,12 +83,12 @@ export const transferInstructionDiscriminator = [163, 52, 200, 231, 140, 3, 69, export function createTransferInstruction( accounts: TransferInstructionAccounts, args: TransferInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = transferStruct.serialize({ instructionDiscriminator: transferInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -128,11 +130,11 @@ export function createTransferInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -140,6 +142,6 @@ export function createTransferInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/unverifyCollection.ts b/clients/js-solita/src/generated/instructions/unverifyCollection.ts index 86ddc0ef..34efda73 100644 --- a/clients/js-solita/src/generated/instructions/unverifyCollection.ts +++ b/clients/js-solita/src/generated/instructions/unverifyCollection.ts @@ -5,9 +5,9 @@ * 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'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type UnverifyCollectionInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; - message: MetadataArgs; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number + message: MetadataArgs +} /** * @category Instructions * @category UnverifyCollection @@ -29,7 +29,7 @@ export type UnverifyCollectionInstructionArgs = { */ export const unverifyCollectionStruct = new beet.FixableBeetArgsStruct< UnverifyCollectionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -41,8 +41,8 @@ export const unverifyCollectionStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'UnverifyCollectionInstructionArgs', -); + 'UnverifyCollectionInstructionArgs' +) /** * Accounts required by the _unverifyCollection_ instruction * @@ -66,26 +66,28 @@ export const unverifyCollectionStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UnverifyCollectionInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - treeDelegate: web3.PublicKey; - collectionAuthority: web3.PublicKey; - collectionAuthorityRecordPda: web3.PublicKey; - collectionMint: web3.PublicKey; - collectionMetadata: web3.PublicKey; - editionAccount: web3.PublicKey; - bubblegumSigner: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - tokenMetadataProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + treeDelegate: web3.PublicKey + collectionAuthority: web3.PublicKey + collectionAuthorityRecordPda: web3.PublicKey + collectionMint: web3.PublicKey + collectionMetadata: web3.PublicKey + editionAccount: web3.PublicKey + bubblegumSigner: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const unverifyCollectionInstructionDiscriminator = [250, 251, 42, 106, 41, 137, 186, 168]; +export const unverifyCollectionInstructionDiscriminator = [ + 250, 251, 42, 106, 41, 137, 186, 168, +] /** * Creates a _UnverifyCollection_ instruction. @@ -100,12 +102,12 @@ export const unverifyCollectionInstructionDiscriminator = [250, 251, 42, 106, 41 export function createUnverifyCollectionInstruction( accounts: UnverifyCollectionInstructionAccounts, args: UnverifyCollectionInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = unverifyCollectionStruct.serialize({ instructionDiscriminator: unverifyCollectionInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -187,11 +189,11 @@ export function createUnverifyCollectionInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -199,6 +201,6 @@ export function createUnverifyCollectionInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/unverifyCreator.ts b/clients/js-solita/src/generated/instructions/unverifyCreator.ts index be34bbbb..7c8a1aeb 100644 --- a/clients/js-solita/src/generated/instructions/unverifyCreator.ts +++ b/clients/js-solita/src/generated/instructions/unverifyCreator.ts @@ -5,9 +5,9 @@ * 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'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type UnverifyCreatorInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; - message: MetadataArgs; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number + message: MetadataArgs +} /** * @category Instructions * @category UnverifyCreator @@ -29,7 +29,7 @@ export type UnverifyCreatorInstructionArgs = { */ export const unverifyCreatorStruct = new beet.FixableBeetArgsStruct< UnverifyCreatorInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -41,8 +41,8 @@ export const unverifyCreatorStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'UnverifyCreatorInstructionArgs', -); + 'UnverifyCreatorInstructionArgs' +) /** * Accounts required by the _unverifyCreator_ instruction * @@ -59,19 +59,21 @@ export const unverifyCreatorStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UnverifyCreatorInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - creator: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + creator: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const unverifyCreatorInstructionDiscriminator = [107, 178, 57, 39, 105, 115, 112, 152]; +export const unverifyCreatorInstructionDiscriminator = [ + 107, 178, 57, 39, 105, 115, 112, 152, +] /** * Creates a _UnverifyCreator_ instruction. @@ -86,12 +88,12 @@ export const unverifyCreatorInstructionDiscriminator = [107, 178, 57, 39, 105, 1 export function createUnverifyCreatorInstruction( accounts: UnverifyCreatorInstructionAccounts, args: UnverifyCreatorInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = unverifyCreatorStruct.serialize({ instructionDiscriminator: unverifyCreatorInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -138,11 +140,11 @@ export function createUnverifyCreatorInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -150,6 +152,6 @@ export function createUnverifyCreatorInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/updateMetadata.ts b/clients/js-solita/src/generated/instructions/updateMetadata.ts new file mode 100644 index 00000000..935ffd01 --- /dev/null +++ b/clients/js-solita/src/generated/instructions/updateMetadata.ts @@ -0,0 +1,182 @@ +/** + * 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' +import { Creator, creatorBeet } from '../types/Creator' + +/** + * @category Instructions + * @category UpdateMetadata + * @category generated + */ +export type UpdateMetadataInstructionArgs = { + root: number[] /* size: 32 */ + oldMetadata: beet.COption + newName: beet.COption + newSymbol: beet.COption + newUri: beet.COption + newCreators: beet.COption + newSellerFeeBasisPoints: beet.COption + newPrimarySaleHappened: beet.COption + newIsMutable: beet.COption + nonce: beet.bignum + index: number +} +/** + * @category Instructions + * @category UpdateMetadata + * @category generated + */ +export const updateMetadataStruct = new beet.FixableBeetArgsStruct< + UpdateMetadataInstructionArgs & { + instructionDiscriminator: number[] /* size: 8 */ + } +>( + [ + ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], + ['root', beet.uniformFixedSizeArray(beet.u8, 32)], + ['oldMetadata', beet.coption(metadataArgsBeet)], + ['newName', beet.coption(beet.utf8String)], + ['newSymbol', beet.coption(beet.utf8String)], + ['newUri', beet.coption(beet.utf8String)], + ['newCreators', beet.coption(beet.array(creatorBeet))], + ['newSellerFeeBasisPoints', beet.coption(beet.u16)], + ['newPrimarySaleHappened', beet.coption(beet.bool)], + ['newIsMutable', beet.coption(beet.bool)], + ['nonce', beet.u64], + ['index', beet.u32], + ], + 'UpdateMetadataInstructionArgs' +) +/** + * Accounts required by the _updateMetadata_ instruction + * + * @property [] oldMetadataAcct + * @property [] treeAuthority + * @property [**signer**] treeDelegate + * @property [] leafOwner + * @property [] leafDelegate + * @property [**signer**] payer + * @property [_writable_] merkleTree + * @property [] logWrapper + * @property [] compressionProgram + * @property [] tokenMetadataProgram + * @category Instructions + * @category UpdateMetadata + * @category generated + */ +export type UpdateMetadataInstructionAccounts = { + oldMetadataAcct: web3.PublicKey + treeAuthority: web3.PublicKey + treeDelegate: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + payer: web3.PublicKey + merkleTree: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} + +export const updateMetadataInstructionDiscriminator = [ + 170, 182, 43, 239, 97, 78, 225, 186, +] + +/** + * Creates a _UpdateMetadata_ 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 UpdateMetadata + * @category generated + */ +export function createUpdateMetadataInstruction( + accounts: UpdateMetadataInstructionAccounts, + args: UpdateMetadataInstructionArgs, + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') +) { + const [data] = updateMetadataStruct.serialize({ + instructionDiscriminator: updateMetadataInstructionDiscriminator, + ...args, + }) + const keys: web3.AccountMeta[] = [ + { + pubkey: accounts.oldMetadataAcct, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.treeAuthority, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.treeDelegate, + isWritable: false, + isSigner: true, + }, + { + pubkey: accounts.leafOwner, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.leafDelegate, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.payer, + isWritable: false, + isSigner: true, + }, + { + pubkey: accounts.merkleTree, + isWritable: true, + isSigner: false, + }, + { + pubkey: accounts.logWrapper, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.compressionProgram, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.tokenMetadataProgram, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, + isWritable: false, + isSigner: false, + }, + ] + + if (accounts.anchorRemainingAccounts != null) { + for (const acc of accounts.anchorRemainingAccounts) { + keys.push(acc) + } + } + + const ix = new web3.TransactionInstruction({ + programId, + keys, + data, + }) + return ix +} diff --git a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts new file mode 100644 index 00000000..afa391ea --- /dev/null +++ b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts @@ -0,0 +1,211 @@ +/** + * 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' +import { Creator, creatorBeet } from '../types/Creator' + +/** + * @category Instructions + * @category UpdateMetadataCollectionNft + * @category generated + */ +export type UpdateMetadataCollectionNftInstructionArgs = { + root: number[] /* size: 32 */ + oldMetadata: beet.COption + newName: beet.COption + newSymbol: beet.COption + newUri: beet.COption + newCreators: beet.COption + newSellerFeeBasisPoints: beet.COption + newPrimarySaleHappened: beet.COption + newIsMutable: beet.COption + nonce: beet.bignum + index: number +} +/** + * @category Instructions + * @category UpdateMetadataCollectionNft + * @category generated + */ +export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< + UpdateMetadataCollectionNftInstructionArgs & { + instructionDiscriminator: number[] /* size: 8 */ + } +>( + [ + ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], + ['root', beet.uniformFixedSizeArray(beet.u8, 32)], + ['oldMetadata', beet.coption(metadataArgsBeet)], + ['newName', beet.coption(beet.utf8String)], + ['newSymbol', beet.coption(beet.utf8String)], + ['newUri', beet.coption(beet.utf8String)], + ['newCreators', beet.coption(beet.array(creatorBeet))], + ['newSellerFeeBasisPoints', beet.coption(beet.u16)], + ['newPrimarySaleHappened', beet.coption(beet.bool)], + ['newIsMutable', beet.coption(beet.bool)], + ['nonce', beet.u64], + ['index', beet.u32], + ], + 'UpdateMetadataCollectionNftInstructionArgs' +) +/** + * Accounts required by the _updateMetadataCollectionNft_ instruction + * + * @property [] oldMetadataAcct + * @property [] treeAuthority + * @property [**signer**] treeDelegate + * @property [] collectionAuthority + * @property [] collectionMint + * @property [] collectionMetadata + * @property [] collectionAuthorityRecordPda + * @property [] leafOwner + * @property [] leafDelegate + * @property [**signer**] payer + * @property [_writable_] merkleTree + * @property [] logWrapper + * @property [] compressionProgram + * @property [] tokenMetadataProgram + * @category Instructions + * @category UpdateMetadataCollectionNft + * @category generated + */ +export type UpdateMetadataCollectionNftInstructionAccounts = { + oldMetadataAcct: web3.PublicKey + treeAuthority: web3.PublicKey + treeDelegate: web3.PublicKey + collectionAuthority: web3.PublicKey + collectionMint: web3.PublicKey + collectionMetadata: web3.PublicKey + collectionAuthorityRecordPda: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + payer: web3.PublicKey + merkleTree: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} + +export const updateMetadataCollectionNftInstructionDiscriminator = [ + 244, 12, 175, 194, 227, 28, 102, 215, +] + +/** + * Creates a _UpdateMetadataCollectionNft_ 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 UpdateMetadataCollectionNft + * @category generated + */ +export function createUpdateMetadataCollectionNftInstruction( + accounts: UpdateMetadataCollectionNftInstructionAccounts, + args: UpdateMetadataCollectionNftInstructionArgs, + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') +) { + const [data] = updateMetadataCollectionNftStruct.serialize({ + instructionDiscriminator: + updateMetadataCollectionNftInstructionDiscriminator, + ...args, + }) + const keys: web3.AccountMeta[] = [ + { + pubkey: accounts.oldMetadataAcct, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.treeAuthority, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.treeDelegate, + isWritable: false, + isSigner: true, + }, + { + pubkey: accounts.collectionAuthority, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.collectionMint, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.collectionMetadata, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.collectionAuthorityRecordPda, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.leafOwner, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.leafDelegate, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.payer, + isWritable: false, + isSigner: true, + }, + { + pubkey: accounts.merkleTree, + isWritable: true, + isSigner: false, + }, + { + pubkey: accounts.logWrapper, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.compressionProgram, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.tokenMetadataProgram, + isWritable: false, + isSigner: false, + }, + { + pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, + isWritable: false, + isSigner: false, + }, + ] + + if (accounts.anchorRemainingAccounts != null) { + for (const acc of accounts.anchorRemainingAccounts) { + keys.push(acc) + } + } + + const ix = new web3.TransactionInstruction({ + programId, + keys, + data, + }) + return ix +} diff --git a/clients/js-solita/src/generated/instructions/verifyCollection.ts b/clients/js-solita/src/generated/instructions/verifyCollection.ts index cec59b74..3c525894 100644 --- a/clients/js-solita/src/generated/instructions/verifyCollection.ts +++ b/clients/js-solita/src/generated/instructions/verifyCollection.ts @@ -5,9 +5,9 @@ * 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'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type VerifyCollectionInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; - message: MetadataArgs; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number + message: MetadataArgs +} /** * @category Instructions * @category VerifyCollection @@ -29,7 +29,7 @@ export type VerifyCollectionInstructionArgs = { */ export const verifyCollectionStruct = new beet.FixableBeetArgsStruct< VerifyCollectionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -41,8 +41,8 @@ export const verifyCollectionStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'VerifyCollectionInstructionArgs', -); + 'VerifyCollectionInstructionArgs' +) /** * Accounts required by the _verifyCollection_ instruction * @@ -66,26 +66,28 @@ export const verifyCollectionStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type VerifyCollectionInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - treeDelegate: web3.PublicKey; - collectionAuthority: web3.PublicKey; - collectionAuthorityRecordPda: web3.PublicKey; - collectionMint: web3.PublicKey; - collectionMetadata: web3.PublicKey; - editionAccount: web3.PublicKey; - bubblegumSigner: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - tokenMetadataProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + treeDelegate: web3.PublicKey + collectionAuthority: web3.PublicKey + collectionAuthorityRecordPda: web3.PublicKey + collectionMint: web3.PublicKey + collectionMetadata: web3.PublicKey + editionAccount: web3.PublicKey + bubblegumSigner: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + tokenMetadataProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const verifyCollectionInstructionDiscriminator = [56, 113, 101, 253, 79, 55, 122, 169]; +export const verifyCollectionInstructionDiscriminator = [ + 56, 113, 101, 253, 79, 55, 122, 169, +] /** * Creates a _VerifyCollection_ instruction. @@ -100,12 +102,12 @@ export const verifyCollectionInstructionDiscriminator = [56, 113, 101, 253, 79, export function createVerifyCollectionInstruction( accounts: VerifyCollectionInstructionAccounts, args: VerifyCollectionInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = verifyCollectionStruct.serialize({ instructionDiscriminator: verifyCollectionInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -187,11 +189,11 @@ export function createVerifyCollectionInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -199,6 +201,6 @@ export function createVerifyCollectionInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/instructions/verifyCreator.ts b/clients/js-solita/src/generated/instructions/verifyCreator.ts index 326432df..8fa05723 100644 --- a/clients/js-solita/src/generated/instructions/verifyCreator.ts +++ b/clients/js-solita/src/generated/instructions/verifyCreator.ts @@ -5,9 +5,9 @@ * 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'; +import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js' +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; * @category generated */ export type VerifyCreatorInstructionArgs = { - root: number[] /* size: 32 */; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - nonce: beet.bignum; - index: number; - message: MetadataArgs; -}; + root: number[] /* size: 32 */ + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + nonce: beet.bignum + index: number + message: MetadataArgs +} /** * @category Instructions * @category VerifyCreator @@ -29,7 +29,7 @@ export type VerifyCreatorInstructionArgs = { */ export const verifyCreatorStruct = new beet.FixableBeetArgsStruct< VerifyCreatorInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */; + instructionDiscriminator: number[] /* size: 8 */ } >( [ @@ -41,8 +41,8 @@ export const verifyCreatorStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'VerifyCreatorInstructionArgs', -); + 'VerifyCreatorInstructionArgs' +) /** * Accounts required by the _verifyCreator_ instruction * @@ -59,19 +59,21 @@ export const verifyCreatorStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type VerifyCreatorInstructionAccounts = { - treeAuthority: web3.PublicKey; - leafOwner: web3.PublicKey; - leafDelegate: web3.PublicKey; - merkleTree: web3.PublicKey; - payer: web3.PublicKey; - creator: web3.PublicKey; - logWrapper: web3.PublicKey; - compressionProgram: web3.PublicKey; - systemProgram?: web3.PublicKey; - anchorRemainingAccounts?: web3.AccountMeta[]; -}; + treeAuthority: web3.PublicKey + leafOwner: web3.PublicKey + leafDelegate: web3.PublicKey + merkleTree: web3.PublicKey + payer: web3.PublicKey + creator: web3.PublicKey + logWrapper: web3.PublicKey + compressionProgram: web3.PublicKey + systemProgram?: web3.PublicKey + anchorRemainingAccounts?: web3.AccountMeta[] +} -export const verifyCreatorInstructionDiscriminator = [52, 17, 96, 132, 71, 4, 85, 194]; +export const verifyCreatorInstructionDiscriminator = [ + 52, 17, 96, 132, 71, 4, 85, 194, +] /** * Creates a _VerifyCreator_ instruction. @@ -86,12 +88,12 @@ export const verifyCreatorInstructionDiscriminator = [52, 17, 96, 132, 71, 4, 85 export function createVerifyCreatorInstruction( accounts: VerifyCreatorInstructionAccounts, args: VerifyCreatorInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') ) { const [data] = verifyCreatorStruct.serialize({ instructionDiscriminator: verifyCreatorInstructionDiscriminator, ...args, - }); + }) const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -138,11 +140,11 @@ export function createVerifyCreatorInstruction( isWritable: false, isSigner: false, }, - ]; + ] if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc); + keys.push(acc) } } @@ -150,6 +152,6 @@ export function createVerifyCreatorInstruction( programId, keys, data, - }); - return ix; + }) + return ix } diff --git a/clients/js-solita/src/generated/types/BubblegumEventType.ts b/clients/js-solita/src/generated/types/BubblegumEventType.ts index 4664cf8d..398515e7 100644 --- a/clients/js-solita/src/generated/types/BubblegumEventType.ts +++ b/clients/js-solita/src/generated/types/BubblegumEventType.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; +import * as beet from '@metaplex-foundation/beet' /** * @category enums * @category generated @@ -20,5 +20,5 @@ export enum BubblegumEventType { * @category generated */ export const bubblegumEventTypeBeet = beet.fixedScalarEnum( - BubblegumEventType, -) as beet.FixedSizeBeet; + BubblegumEventType +) as beet.FixedSizeBeet diff --git a/clients/js-solita/src/generated/types/Collection.ts b/clients/js-solita/src/generated/types/Collection.ts index eb5c48a1..f7402e06 100644 --- a/clients/js-solita/src/generated/types/Collection.ts +++ b/clients/js-solita/src/generated/types/Collection.ts @@ -5,13 +5,13 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js'; -import * as beet from '@metaplex-foundation/beet'; -import * as beetSolana from '@metaplex-foundation/beet-solana'; +import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet' +import * as beetSolana from '@metaplex-foundation/beet-solana' export type Collection = { - verified: boolean; - key: web3.PublicKey; -}; + verified: boolean + key: web3.PublicKey +} /** * @category userTypes @@ -22,5 +22,5 @@ export const collectionBeet = new beet.BeetArgsStruct( ['verified', beet.bool], ['key', beetSolana.publicKey], ], - 'Collection', -); + 'Collection' +) diff --git a/clients/js-solita/src/generated/types/Creator.ts b/clients/js-solita/src/generated/types/Creator.ts index 971572a4..59ef0eb0 100644 --- a/clients/js-solita/src/generated/types/Creator.ts +++ b/clients/js-solita/src/generated/types/Creator.ts @@ -5,14 +5,14 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js'; -import * as beetSolana from '@metaplex-foundation/beet-solana'; -import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js' +import * as beetSolana from '@metaplex-foundation/beet-solana' +import * as beet from '@metaplex-foundation/beet' export type Creator = { - address: web3.PublicKey; - verified: boolean; - share: number; -}; + address: web3.PublicKey + verified: boolean + share: number +} /** * @category userTypes @@ -24,5 +24,5 @@ export const creatorBeet = new beet.BeetArgsStruct( ['verified', beet.bool], ['share', beet.u8], ], - 'Creator', -); + 'Creator' +) diff --git a/clients/js-solita/src/generated/types/InstructionName.ts b/clients/js-solita/src/generated/types/InstructionName.ts index 1c925099..237f5409 100644 --- a/clients/js-solita/src/generated/types/InstructionName.ts +++ b/clients/js-solita/src/generated/types/InstructionName.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; +import * as beet from '@metaplex-foundation/beet' /** * @category enums * @category generated @@ -28,13 +28,13 @@ export enum InstructionName { SetAndVerifyCollection, MintToCollectionV1, SetDecompressableState, + UpdateMetadata, } /** * @category userTypes * @category generated */ -export const instructionNameBeet = beet.fixedScalarEnum(InstructionName) as beet.FixedSizeBeet< - InstructionName, +export const instructionNameBeet = beet.fixedScalarEnum( InstructionName ->; +) as beet.FixedSizeBeet diff --git a/clients/js-solita/src/generated/types/LeafSchema.ts b/clients/js-solita/src/generated/types/LeafSchema.ts index f52a4c79..dc1dc77f 100644 --- a/clients/js-solita/src/generated/types/LeafSchema.ts +++ b/clients/js-solita/src/generated/types/LeafSchema.ts @@ -5,9 +5,9 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js'; -import * as beet from '@metaplex-foundation/beet'; -import * as beetSolana from '@metaplex-foundation/beet-solana'; +import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet' +import * as beetSolana from '@metaplex-foundation/beet-solana' /** * This type is used to derive the {@link LeafSchema} type as well as the de/serializer. * However don't refer to it in your code but use the {@link LeafSchema} type instead. @@ -19,14 +19,14 @@ import * as beetSolana from '@metaplex-foundation/beet-solana'; */ export type LeafSchemaRecord = { V1: { - id: web3.PublicKey; - owner: web3.PublicKey; - delegate: web3.PublicKey; - nonce: beet.bignum; - dataHash: number[] /* size: 32 */; - creatorHash: number[] /* size: 32 */; - }; -}; + id: web3.PublicKey + owner: web3.PublicKey + delegate: web3.PublicKey + nonce: beet.bignum + dataHash: number[] /* size: 32 */ + creatorHash: number[] /* size: 32 */ + } +} /** * Union type respresenting the LeafSchema data enum defined in Rust. @@ -39,10 +39,11 @@ export type LeafSchemaRecord = { * @category enums * @category generated */ -export type LeafSchema = beet.DataEnumKeyAsKind; +export type LeafSchema = beet.DataEnumKeyAsKind -export const isLeafSchemaV1 = (x: LeafSchema): x is LeafSchema & { __kind: 'V1' } => - x.__kind === 'V1'; +export const isLeafSchemaV1 = ( + x: LeafSchema +): x is LeafSchema & { __kind: 'V1' } => x.__kind === 'V1' /** * @category userTypes @@ -60,7 +61,7 @@ export const leafSchemaBeet = beet.dataEnum([ ['dataHash', beet.uniformFixedSizeArray(beet.u8, 32)], ['creatorHash', beet.uniformFixedSizeArray(beet.u8, 32)], ], - 'LeafSchemaRecord["V1"]', + 'LeafSchemaRecord["V1"]' ), ], ]) as beet.FixableBeet; diff --git a/clients/js-solita/src/generated/types/MetadataArgs.ts b/clients/js-solita/src/generated/types/MetadataArgs.ts index c4bd4731..cf5c41ea 100644 --- a/clients/js-solita/src/generated/types/MetadataArgs.ts +++ b/clients/js-solita/src/generated/types/MetadataArgs.ts @@ -5,26 +5,29 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import { TokenStandard, tokenStandardBeet } from './TokenStandard'; -import { Collection, collectionBeet } from './Collection'; -import { Uses, usesBeet } from './Uses'; -import { TokenProgramVersion, tokenProgramVersionBeet } from './TokenProgramVersion'; -import { Creator, creatorBeet } from './Creator'; +import * as beet from '@metaplex-foundation/beet' +import { TokenStandard, tokenStandardBeet } from './TokenStandard' +import { Collection, collectionBeet } from './Collection' +import { Uses, usesBeet } from './Uses' +import { + TokenProgramVersion, + tokenProgramVersionBeet, +} from './TokenProgramVersion' +import { Creator, creatorBeet } from './Creator' export type MetadataArgs = { - name: string; - symbol: string; - uri: string; - sellerFeeBasisPoints: number; - primarySaleHappened: boolean; - isMutable: boolean; - editionNonce: beet.COption; - tokenStandard: beet.COption; - collection: beet.COption; - uses: beet.COption; - tokenProgramVersion: TokenProgramVersion; - creators: Creator[]; -}; + name: string + symbol: string + uri: string + sellerFeeBasisPoints: number + primarySaleHappened: boolean + isMutable: boolean + editionNonce: beet.COption + tokenStandard: beet.COption + collection: beet.COption + uses: beet.COption + tokenProgramVersion: TokenProgramVersion + creators: Creator[] +} /** * @category userTypes @@ -45,5 +48,5 @@ export const metadataArgsBeet = new beet.FixableBeetArgsStruct( ['tokenProgramVersion', tokenProgramVersionBeet], ['creators', beet.array(creatorBeet)], ], - 'MetadataArgs', -); + 'MetadataArgs' +) diff --git a/clients/js-solita/src/generated/types/TokenProgramVersion.ts b/clients/js-solita/src/generated/types/TokenProgramVersion.ts index 60effbe5..3da19eb2 100644 --- a/clients/js-solita/src/generated/types/TokenProgramVersion.ts +++ b/clients/js-solita/src/generated/types/TokenProgramVersion.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; +import * as beet from '@metaplex-foundation/beet' /** * @category enums * @category generated @@ -20,5 +20,5 @@ export enum TokenProgramVersion { * @category generated */ export const tokenProgramVersionBeet = beet.fixedScalarEnum( - TokenProgramVersion, -) as beet.FixedSizeBeet; + TokenProgramVersion +) as beet.FixedSizeBeet diff --git a/clients/js-solita/src/generated/types/TokenStandard.ts b/clients/js-solita/src/generated/types/TokenStandard.ts index dc449df0..0dddfc94 100644 --- a/clients/js-solita/src/generated/types/TokenStandard.ts +++ b/clients/js-solita/src/generated/types/TokenStandard.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; +import * as beet from '@metaplex-foundation/beet' /** * @category enums * @category generated @@ -21,7 +21,6 @@ export enum TokenStandard { * @category userTypes * @category generated */ -export const tokenStandardBeet = beet.fixedScalarEnum(TokenStandard) as beet.FixedSizeBeet< - TokenStandard, +export const tokenStandardBeet = beet.fixedScalarEnum( TokenStandard ->; +) as beet.FixedSizeBeet diff --git a/clients/js-solita/src/generated/types/UseMethod.ts b/clients/js-solita/src/generated/types/UseMethod.ts index dfdec71a..3c26540c 100644 --- a/clients/js-solita/src/generated/types/UseMethod.ts +++ b/clients/js-solita/src/generated/types/UseMethod.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; +import * as beet from '@metaplex-foundation/beet' /** * @category enums * @category generated @@ -20,7 +20,6 @@ export enum UseMethod { * @category userTypes * @category generated */ -export const useMethodBeet = beet.fixedScalarEnum(UseMethod) as beet.FixedSizeBeet< - UseMethod, +export const useMethodBeet = beet.fixedScalarEnum( UseMethod ->; +) as beet.FixedSizeBeet diff --git a/clients/js-solita/src/generated/types/Uses.ts b/clients/js-solita/src/generated/types/Uses.ts index 1381ee33..ee3dc2a2 100644 --- a/clients/js-solita/src/generated/types/Uses.ts +++ b/clients/js-solita/src/generated/types/Uses.ts @@ -5,13 +5,13 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; -import { UseMethod, useMethodBeet } from './UseMethod'; +import * as beet from '@metaplex-foundation/beet' +import { UseMethod, useMethodBeet } from './UseMethod' export type Uses = { - useMethod: UseMethod; - remaining: beet.bignum; - total: beet.bignum; -}; + useMethod: UseMethod + remaining: beet.bignum + total: beet.bignum +} /** * @category userTypes @@ -23,5 +23,5 @@ export const usesBeet = new beet.BeetArgsStruct( ['remaining', beet.u64], ['total', beet.u64], ], - 'Uses', -); + 'Uses' +) diff --git a/clients/js-solita/src/generated/types/Version.ts b/clients/js-solita/src/generated/types/Version.ts index 7855039e..3461176c 100644 --- a/clients/js-solita/src/generated/types/Version.ts +++ b/clients/js-solita/src/generated/types/Version.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet'; +import * as beet from '@metaplex-foundation/beet' /** * @category enums * @category generated @@ -18,4 +18,7 @@ export enum Version { * @category userTypes * @category generated */ -export const versionBeet = beet.fixedScalarEnum(Version) as beet.FixedSizeBeet; +export const versionBeet = beet.fixedScalarEnum(Version) as beet.FixedSizeBeet< + Version, + Version +> diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index c70c4074..1467e868 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -25,11 +25,14 @@ import { createBurnInstruction, createRedeemInstruction, createDecompressV1Instruction, + createUpdateMetadataInstruction, MetadataArgs, PROGRAM_ID as BUBBLEGUM_PROGRAM_ID, TokenProgramVersion, TokenStandard, Creator, + createMintToCollectionV1Instruction, + createUpdateMetadataCollectionNftInstruction, } from '../src/generated'; import { getLeafAssetId, computeDataHash, computeCreatorHash, computeCompressedNFTHash } from '../src/mpl-bubblegum'; import { BN } from 'bn.js'; @@ -38,6 +41,8 @@ import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token"; +import { assert } from 'chai'; +import { Metaplex, keypairIdentity, CreateCompressedNftOutput } from "@metaplex-foundation/js"; function keypairFromSeed(seed: string) { const expandedSeed = Uint8Array.from( @@ -59,7 +64,41 @@ function makeCompressedNFT(name: string, symbol: string, creators: Creator[] = [ collection: null, primarySaleHappened: false, sellerFeeBasisPoints: 0, - isMutable: false, + isMutable: true, + }; +} + +async function setupCertifiedCollection(connection: Connection, name: string, symbol: string, uri: string, updateAuthority: Keypair): Promise { + const metaplex = Metaplex.make(connection).use(keypairIdentity(updateAuthority)) + const collectionInfo = await metaplex.nfts().create({ + uri, + name, + sellerFeeBasisPoints: 500, + updateAuthority, + tokenOwner: updateAuthority.publicKey, + symbol, + creators: [{address: updateAuthority.publicKey, share: 100, authority: updateAuthority}], + isMutable: true, + primarySaleHappened: false, + isCollection: true, + }); + return collectionInfo +} + +function makeCompressedCollectionNFT(name: string, symbol: string, uri: string, collection: PublicKey, creators: Creator[] = []): MetadataArgs { + return { + name: name, + symbol: symbol, + uri, + creators, + editionNonce: 0, + tokenProgramVersion: TokenProgramVersion.Original, + tokenStandard: TokenStandard.NonFungible, + uses: null, + collection: { key: collection, verified: false }, + primarySaleHappened: false, + sellerFeeBasisPoints: 0, + isMutable: true, }; } @@ -78,7 +117,7 @@ async function setupTreeWithCompressedNFT( const merkleTreeKeypair = Keypair.generate(); const merkleTree = merkleTreeKeypair.publicKey; - const space = getConcurrentMerkleTreeAccountSize(depthSizePair.maxDepth, depthSizePair.maxBufferSize); + const space = getConcurrentMerkleTreeAccountSize(depthSizePair.maxDepth, depthSizePair.maxBufferSize, depthSizePair.maxDepth); const allocTreeIx = SystemProgram.createAccount({ fromPubkey: payer, newAccountPubkey: merkleTree, @@ -135,13 +174,50 @@ async function setupTreeWithCompressedNFT( }; } +async function verifyLeaf( + connection: Connection, + payerKeypair: Keypair, + owner: PublicKey, + delegate: PublicKey, + index: number, + merkleTree: PublicKey, + metadata: MetadataArgs +): Promise<{success: boolean}> { + const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); + + // Verify leaf exists. + const leafIndex = new BN.BN(index); + const assetId = await getLeafAssetId(merkleTree, leafIndex); + const verifyLeafIx = createVerifyLeafIx( + merkleTree, + { + root: account.getCurrentRoot(), + leaf: computeCompressedNFTHash(assetId, owner, delegate, leafIndex, metadata), + leafIndex: index, + proof: [], + } + ); + const tx = new Transaction().add(verifyLeafIx); + const txId = await sendAndConfirmTransaction(connection, tx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + console.log('Verified NFT existence:', txId); + return { + success: true + } +} + describe('Bubblegum tests', () => { - const connection = new Connection('http://localhost:8899'); + const connection = new Connection('http://127.0.0.1:8899'); const payerKeypair = keypairFromSeed('metaplex-test09870987098709870987009709870987098709870987'); const payer = payerKeypair.publicKey; beforeEach(async () => { - await connection.requestAirdrop(payer, LAMPORTS_PER_SOL); + const airdropSig = await connection.requestAirdrop(payer, 10*LAMPORTS_PER_SOL); + const latestBlockhash = await connection.getLatestBlockhash(); + await connection.confirmTransaction({blockhash: latestBlockhash.blockhash, lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, signature: airdropSig}); }); it('Can create a Bubblegum tree and mint to it', async () => { const compressedNFT: MetadataArgs = { @@ -161,8 +237,9 @@ describe('Bubblegum tests', () => { await setupTreeWithCompressedNFT(connection, payerKeypair, compressedNFT, { maxDepth: 14, maxBufferSize: 64 }); }); + // TODO sorend: move to bottom of file describe('Unit test compressed NFT instructions', () => { - let merkleTree: PublicKey; + const MAX_DEPTH = 14; let creators: Creator[] = [ { address: payer, @@ -174,47 +251,274 @@ describe('Bubblegum tests', () => { share: 45, verified: false, }, - ] + ]; + let merkleTree: PublicKey; const originalCompressedNFT = makeCompressedNFT('test', 'TST', creators); beforeEach(async () => { - await connection.requestAirdrop(payer, LAMPORTS_PER_SOL); const result = await setupTreeWithCompressedNFT( connection, payerKeypair, originalCompressedNFT, { - maxDepth: 14, + maxDepth: MAX_DEPTH, maxBufferSize: 64, } ); merkleTree = result.merkleTree; }); - it('Can verify existence a compressed NFT', async () => { - // Todo(@ngundotra): expose commitment level in ConcurrentMerkleTreeAccount.fromAddress - const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); - const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); + it('Non-collection NFT Update', async () => { + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); + const [treeAuthority] = PublicKey.findProgramAddressSync( + [merkleTree.toBuffer()], + BUBBLEGUM_PROGRAM_ID, + ); + const updateMetadataIx = createUpdateMetadataInstruction( + { + oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + oldMetadata: originalCompressedNFT, + newName: 'NewName', + newSymbol: 'NewSymbol', + newUri: 'https://foobar.com', + newCreators: null, + newSellerFeeBasisPoints: null, + newPrimarySaleHappened: null, + newIsMutable: null, + nonce: 0, + index: 0 + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Update metadata tx success:", updateMetadataTxId) + + const newMetadataArgs: MetadataArgs = { ...originalCompressedNFT, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; + + // We should now be able to verify the new leaf with the metadata replaced + await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, newMetadataArgs); + }); + it('Collection NFT Update', async () => { + const collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) + const [bubblegumSigner] = PublicKey.findProgramAddressSync([Buffer.from("collection_cpi")], BUBBLEGUM_PROGRAM_ID); + const metadataArgs = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); + const [treeAuthority] = PublicKey.findProgramAddressSync( + [merkleTree.toBuffer()], + BUBBLEGUM_PROGRAM_ID, + ); - // Verify leaf exists. - const leafIndex = new BN.BN(0); - const assetId = await getLeafAssetId(merkleTree, leafIndex); - const verifyLeafIx = createVerifyLeafIx( + // Mint a New NFT to a Collection + const mintToCollectionIx = createMintToCollectionV1Instruction({ + treeAuthority, + leafOwner: payer, + leafDelegate: payer, merkleTree, + payer, + treeDelegate: payer, + collectionAuthority: payer, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, + collectionMint: collection.mintAddress, + collectionMetadata: collection.metadataAddress, + editionAccount: collection.masterEditionAddress, + bubblegumSigner, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, { + metadataArgs: metadataArgs + }); + + const mintToCollectionTxId = await sendAndConfirmTransaction(connection, new Transaction().add(mintToCollectionIx), [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Mint to Collection Success:", mintToCollectionTxId); + + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); + + // Update the NFT in the collection + const oldMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } + const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( { - root: account.getCurrentRoot(), - leaf: computeCompressedNFTHash(assetId, payer, payer, leafIndex, originalCompressedNFT), - leafIndex: 0, - proof: [], + oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + collectionAuthority: payer, + collectionMint: collection.mintAddress, + collectionMetadata: collection.metadataAddress, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree + oldMetadata: oldMetadataArgs, + newName: 'NewName', + newSymbol: 'NewSymbol', + newUri: 'https://foobar.com', + newCreators: null, + newSellerFeeBasisPoints: null, + newPrimarySaleHappened: null, + newIsMutable: null, + nonce: 1, + index: 1 + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Update metadata tx success:", updateMetadataTxId) + + const newMetadataArgs: MetadataArgs = { ...oldMetadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; + + // We should now be able to verify the new leaf with the metadata replaced + await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); + }); + }) + + describe.skip('Unit test compressed NFT collection instructions', () => { + const MAX_DEPTH = 14; + let merkleTree: PublicKey; + let originalCompressedNFT: MetadataArgs; + let collection: CreateCompressedNftOutput; + beforeEach(async () => { + await connection.requestAirdrop(payer, LAMPORTS_PER_SOL); + console.log(await connection.getBalance(payer)); + collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) + originalCompressedNFT = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); + const result = await setupTreeWithCompressedNFT( + connection, + payerKeypair, + originalCompressedNFT, + { + maxDepth: MAX_DEPTH, + maxBufferSize: 64, } ); - const tx = new Transaction().add(verifyLeafIx); - const txId = await sendAndConfirmTransaction(connection, tx, [payerKeypair], { + merkleTree = result.merkleTree; + }); + + // TODO sorend: remove this test + it('Can verify existence of a compressed NFT', async () => { + const updateSuccess = await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, originalCompressedNFT); + assert(updateSuccess.success === true, "Failed to verify leaf"); + }); + + it.skip('Collection NFT Update', async () => { + const collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) + const [bubblegumSigner] = PublicKey.findProgramAddressSync([Buffer.from("collection_cpi")], BUBBLEGUM_PROGRAM_ID); + const [treeAuthority] = PublicKey.findProgramAddressSync( + [merkleTree.toBuffer()], + BUBBLEGUM_PROGRAM_ID, + ); + const metadataArgs = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); + + // Mint a New NFT to a Collection + const mintToCollectionIx = createMintToCollectionV1Instruction({ + treeAuthority, + leafOwner: payer, + leafDelegate: payer, + merkleTree, + payer, + treeDelegate: payer, + collectionAuthority: payer, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, + collectionMint: collection.mintAddress, + collectionMetadata: collection.metadataAddress, + editionAccount: collection.masterEditionAddress, + bubblegumSigner, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, { + metadataArgs + }) + + const mintToCollectionTxId = await sendAndConfirmTransaction(connection, new Transaction().add(mintToCollectionIx), [payerKeypair], { commitment: 'confirmed', skipPreflight: true, }); - console.log('Verified NFT existence:', txId); + + console.log("Mint to Collection Success:", mintToCollectionTxId) + + // Update the NFT in the collection + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); + const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( + { + oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + collectionAuthority: payer, + collectionMint: collection.mintAddress, + collectionMetadata: collection.metadataAddress, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + oldMetadata: metadataArgs, + newName: 'NewName', + newSymbol: 'NewSymbol', + newUri: 'https://foobar.com', + newCreators: null, + newSellerFeeBasisPoints: null, + newPrimarySaleHappened: null, + newIsMutable: null, + nonce: 0, + index: 1 + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Update metadata tx success:", updateMetadataTxId) + + const newMetadataArgs: MetadataArgs = { ...metadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; + + // We should now be able to verify the new leaf with the metadata replaced + await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); }); - it('Can transfer and burn a compressed NFT', async () => { + it.skip('Can transfer and burn a compressed NFT', async () => { // Transfer. const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); @@ -282,7 +586,7 @@ describe('Bubblegum tests', () => { console.log('NFT burn tx:', burnTxId); }); - it('Can redeem and decompress compressed NFT', async () => { + it.skip('Can redeem and decompress compressed NFT', async () => { // Redeem. const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); diff --git a/clients/js-solita/yarn.lock b/clients/js-solita/yarn.lock index 835d2253..1f00bfcb 100644 --- a/clients/js-solita/yarn.lock +++ b/clients/js-solita/yarn.lock @@ -311,6 +311,31 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@bundlr-network/client@^0.8.8": + version "0.8.9" + resolved "https://registry.yarnpkg.com/@bundlr-network/client/-/client-0.8.9.tgz#58e969a5d80f8d25d212d46bb7a060730a3c1736" + integrity sha512-SJ7BAt/KhONeFQ0+nbqrw2DUWrsev6y6cmlXt+3x7fPCkw7OJwudtxV/h2nBteZd65NXjqw8yzkmLiLfZ7CCRA== + dependencies: + "@solana/wallet-adapter-base" "^0.9.2" + "@solana/web3.js" "^1.36.0" + "@supercharge/promise-pool" "^2.1.0" + algosdk "^1.13.1" + arbundles "^0.6.21" + arweave "^1.11.4" + async-retry "^1.3.3" + axios "^0.25.0" + base64url "^3.0.1" + bignumber.js "^9.0.1" + bs58 "^4.0.1" + commander "^8.2.0" + csv "^6.0.5" + ethers "^5.5.1" + inquirer "^8.2.0" + js-sha256 "^0.9.0" + mime-types "^2.1.34" + near-api-js "^0.44.2" + near-seed-phrase "^0.2.0" + "@eslint/eslintrc@^1.3.3": version "1.3.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" @@ -326,6 +351,348 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" + integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" + integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" + integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" + integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" + integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" + integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + bn.js "^5.2.1" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" + integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" + integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + +"@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz#eb7aca84a588508369562e16e514b539ba5240a7" + integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" + integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + js-sha3 "0.8.0" + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" + integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" + integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" + integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== + dependencies: + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" + integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" + integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + bn.js "^5.2.1" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" + integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" + integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== + dependencies: + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + +"@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/json-wallets" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.7.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" + integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== + dependencies: + "@ethersproject/base64" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@hapi/hoek@^9.0.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -664,7 +1031,7 @@ bs58 "^5.0.0" debug "^4.3.4" -"@metaplex-foundation/beet-solana@^0.3.1": +"@metaplex-foundation/beet-solana@^0.3.0", "@metaplex-foundation/beet-solana@^0.3.1": version "0.3.1" resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz#4b37cda5c7f32ffd2bdd8b3164edc05c6463ab35" integrity sha512-tgyEl6dvtLln8XX81JyBvWjIiEcjTkUwZbrM5dIobTmoqMuGewSyk9CClno8qsMsFdB5T3jC91Rjeqmu/6xk2g== @@ -683,11 +1050,132 @@ bn.js "^5.2.0" debug "^4.3.3" +"@metaplex-foundation/beet@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet/-/beet-0.4.0.tgz#eb2a0a6eb084bb25d67dd9bed2f7387ee7e63a55" + integrity sha512-2OAKJnLatCc3mBXNL0QmWVQKAWK2C7XDfepgL0p/9+8oSx4bmRAFHFqptl1A/C0U5O3dxGwKfmKluW161OVGcA== + dependencies: + ansicolors "^0.3.2" + bn.js "^5.2.0" + debug "^4.3.3" + +"@metaplex-foundation/beet@^0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet/-/beet-0.6.1.tgz#6331bdde0648bf2cae6f9e482f8e3552db05d69f" + integrity sha512-OYgnijLFzw0cdUlRKH5POp0unQECPOW9muJ2X3QIVyak5G6I6l/rKo72sICgPLIFKdmsi2jmnkuLY7wp14iXdw== + dependencies: + ansicolors "^0.3.2" + bn.js "^5.2.0" + debug "^4.3.3" + "@metaplex-foundation/cusper@^0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz#dc2032a452d6c269e25f016aa4dd63600e2af975" integrity sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA== +"@metaplex-foundation/js@^0.19.4": + version "0.19.4" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/js/-/js-0.19.4.tgz#992fe6b48e8dd0374d99028a07f75547cb6381d7" + integrity sha512-fiAaMl4p7v1tcU7ZoEr1lCzE6JR2gEWGeHOBarLTpiCjMe8ni3E+cukJQC6p0Ik+Z6IIFtEVNNy5OnMS3LLS4A== + dependencies: + "@bundlr-network/client" "^0.8.8" + "@metaplex-foundation/beet" "0.7.1" + "@metaplex-foundation/mpl-auction-house" "^2.3.0" + "@metaplex-foundation/mpl-bubblegum" "^0.6.2" + "@metaplex-foundation/mpl-candy-guard" "^0.3.0" + "@metaplex-foundation/mpl-candy-machine" "^5.0.0" + "@metaplex-foundation/mpl-candy-machine-core" "^0.1.2" + "@metaplex-foundation/mpl-token-metadata" "^2.11.0" + "@noble/ed25519" "^1.7.1" + "@noble/hashes" "^1.1.3" + "@solana/spl-account-compression" "^0.1.8" + "@solana/spl-token" "^0.3.5" + "@solana/web3.js" "^1.63.1" + bignumber.js "^9.0.2" + bn.js "^5.2.1" + bs58 "^5.0.0" + buffer "^6.0.3" + debug "^4.3.4" + eventemitter3 "^4.0.7" + lodash.clonedeep "^4.5.0" + lodash.isequal "^4.5.0" + merkletreejs "^0.2.32" + mime "^3.0.0" + node-fetch "^2.6.7" + +"@metaplex-foundation/mpl-auction-house@^2.3.0": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-auction-house/-/mpl-auction-house-2.5.1.tgz#ea0e21e594b0db5e73f88688eb2e7c9b748b378b" + integrity sha512-O+IAdYVaoOvgACB8pm+1lF5BNEjl0COkqny2Ho8KQZwka6aC/vHbZ239yRwAMtJhf5992BPFdT4oifjyE0O+Mw== + dependencies: + "@metaplex-foundation/beet" "^0.6.1" + "@metaplex-foundation/beet-solana" "^0.3.1" + "@metaplex-foundation/cusper" "^0.0.2" + "@solana/spl-token" "^0.3.5" + "@solana/web3.js" "^1.56.2" + bn.js "^5.2.0" + +"@metaplex-foundation/mpl-bubblegum@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-bubblegum/-/mpl-bubblegum-0.6.2.tgz#e1b098ccef10899b0d759a03e3d4b1ae7bdc9f0c" + integrity sha512-4tF7/FFSNtpozuIGD7gMKcqK2D49eVXZ144xiowC5H1iBeu009/oj2m8Tj6n4DpYFKWJ2JQhhhk0a2q7x0Begw== + dependencies: + "@metaplex-foundation/beet" "0.7.1" + "@metaplex-foundation/beet-solana" "0.4.0" + "@metaplex-foundation/cusper" "^0.0.2" + "@metaplex-foundation/mpl-token-metadata" "^2.5.2" + "@solana/spl-account-compression" "^0.1.4" + "@solana/spl-token" "^0.1.8" + "@solana/web3.js" "^1.50.1" + bn.js "^5.2.0" + js-sha3 "^0.8.0" + +"@metaplex-foundation/mpl-candy-guard@^0.3.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-candy-guard/-/mpl-candy-guard-0.3.2.tgz#426e89793676b42e9bbb5e523303fba36ccd5281" + integrity sha512-QWXzPDz+6OR3957LtfW6/rcGvFWS/0AeHJa/BUO2VEVQxN769dupsKGtrsS8o5RzXCeap3wrCtDSNxN3dnWu4Q== + dependencies: + "@metaplex-foundation/beet" "^0.4.0" + "@metaplex-foundation/beet-solana" "^0.3.0" + "@metaplex-foundation/cusper" "^0.0.2" + "@solana/web3.js" "^1.66.2" + bn.js "^5.2.0" + +"@metaplex-foundation/mpl-candy-machine-core@^0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-candy-machine-core/-/mpl-candy-machine-core-0.1.2.tgz#07e19558d0ef120fac1d8612ae4de90d52cd4d1f" + integrity sha512-jjDkRvMR+iykt7guQ7qVnOHTZedql0lq3xqWDMaenAUCH3Xrf2zKATThhJppIVNX1/YtgBOO3lGqhaFbaI4pCw== + dependencies: + "@metaplex-foundation/beet" "^0.4.0" + "@metaplex-foundation/beet-solana" "^0.3.0" + "@metaplex-foundation/cusper" "^0.0.2" + "@solana/web3.js" "^1.56.2" + bn.js "^5.2.0" + +"@metaplex-foundation/mpl-candy-machine@^5.0.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-candy-machine/-/mpl-candy-machine-5.1.0.tgz#9469914b312ac36b7cf608123508f3f3f5080010" + integrity sha512-pjHpUpWVOCDxK3l6dXxfmJKNQmbjBqnm5ElOl1mJAygnzO8NIPQvrP89y6xSNyo8qZsJyt4ZMYUyD0TdbtKZXQ== + dependencies: + "@metaplex-foundation/beet" "^0.7.1" + "@metaplex-foundation/beet-solana" "^0.4.0" + "@metaplex-foundation/cusper" "^0.0.2" + "@solana/spl-token" "^0.3.6" + "@solana/web3.js" "^1.66.2" + +"@metaplex-foundation/mpl-token-metadata@^2.11.0": + version "2.12.0" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.12.0.tgz#9817b2d133c5af46c28ab284316b6985ef62b331" + integrity sha512-DetC2F5MwMRt4TmLXwj8PJ8nClRYGMecSQ4pr9iKKa+rWertHgKoJHl2XhheRa084GtL7i0ssOKbX2gfYFosuQ== + dependencies: + "@metaplex-foundation/beet" "^0.7.1" + "@metaplex-foundation/beet-solana" "^0.4.0" + "@metaplex-foundation/cusper" "^0.0.2" + "@solana/spl-token" "^0.3.6" + "@solana/web3.js" "^1.66.2" + bn.js "^5.2.0" + debug "^4.3.4" + "@metaplex-foundation/mpl-token-metadata@^2.5.2": version "2.5.2" resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.5.2.tgz#ec84464e2bf65bf491abdc71c3882e5973dd9978" @@ -786,6 +1274,18 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@randlabs/communication-bridge@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz#d1ecfc29157afcbb0ca2d73122d67905eecb5bf3" + integrity sha512-CzS0U8IFfXNK7QaJFE4pjbxDGfPjbXBEsEaCn9FN15F+ouSAEUQkva3Gl66hrkBZOGexKFEWMwUHIDKpZ2hfVg== + +"@randlabs/myalgo-connect@^1.1.2": + version "1.4.2" + resolved "https://registry.yarnpkg.com/@randlabs/myalgo-connect/-/myalgo-connect-1.4.2.tgz#ce3ad97b3889ea21da75852187511d3f6be0fa05" + integrity sha512-K9hEyUi7G8tqOp7kWIALJLVbGCByhilcy6123WfcorxWwiE1sbQupPyIU5f3YdQK6wMjBsyTWiLW52ZBMp7sXA== + dependencies: + "@randlabs/communication-bridge" "1.0.1" + "@sideway/address@^4.1.3": version "4.1.4" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0" @@ -854,6 +1354,18 @@ bn.js "^5.2.1" borsh "^0.7.0" +"@solana/spl-account-compression@^0.1.8": + version "0.1.8" + resolved "https://registry.yarnpkg.com/@solana/spl-account-compression/-/spl-account-compression-0.1.8.tgz#0c1fd052befddd90c2e8704b0b685761799d4bae" + integrity sha512-vsvsx358pVFPtyNd8zIZy0lezR0NuvOykQ29Zq+8oto+kHfTXMGXXQ1tKHUYke6XkINIWLFVg/jDi+1D9RYaqQ== + dependencies: + "@metaplex-foundation/beet" "^0.7.1" + "@metaplex-foundation/beet-solana" "^0.4.0" + bn.js "^5.2.1" + borsh "^0.7.0" + js-sha3 "^0.8.0" + typescript-collections "^1.3.3" + "@solana/spl-token-registry@^0.2.2405": version "0.2.4574" resolved "https://registry.yarnpkg.com/@solana/spl-token-registry/-/spl-token-registry-0.2.4574.tgz#13f4636b7bec90d2bb43bbbb83512cd90d2ce257" @@ -883,6 +1395,15 @@ "@solana/web3.js" "^1.32.0" start-server-and-test "^1.14.0" +"@solana/spl-token@^0.3.5": + version "0.3.8" + resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.8.tgz#8e9515ea876e40a4cc1040af865f61fc51d27edf" + integrity sha512-ogwGDcunP9Lkj+9CODOWMiVJEdRtqHAtX2rWF62KxnnSWtMZtV9rDhTrZFshiyJmxDnRL/1nKE1yJHg4jjs3gg== + dependencies: + "@solana/buffer-layout" "^4.0.0" + "@solana/buffer-layout-utils" "^0.2.0" + buffer "^6.0.3" + "@solana/spl-token@^0.3.6": version "0.3.6" resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.6.tgz#35473ad2ed71fe91e5754a2ac72901e1b8b26a42" @@ -967,7 +1488,7 @@ dependencies: "@babel/types" "^7.3.0" -"@types/bn.js@^5.1.1": +"@types/bn.js@^5.1.0", "@types/bn.js@^5.1.1": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz#b51e1b55920a4ca26e9285ff79936bbdec910682" integrity sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g== @@ -1052,16 +1573,35 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.11.tgz#1d455ac0211549a8409d3cdb371cd55cc971e8dc" integrity sha512-KJ021B1nlQUBLopzZmPBVuGU9un7WJd/W4ya7Ih02B4Uwky5Nja0yGYav2EfYIk0RR2Q9oVhf60S2XR1BCWJ2g== +"@types/node@11.11.6": + version "11.11.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" + integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== + "@types/node@^12.12.54": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== +"@types/pbkdf2@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz#039a0e9b67da0cdc4ee5dab865caa6b267bb66b1" + integrity sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ== + dependencies: + "@types/node" "*" + "@types/prettier@^2.1.5": version "2.7.1" resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e" integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow== +"@types/secp256k1@^4.0.1": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.3.tgz#1b8e55d8e00f08ee7220b4d59a6abe89c37a901c" + integrity sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w== + dependencies: + "@types/node" "*" + "@types/semver@^7.3.12": version "7.3.13" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" @@ -1193,6 +1733,18 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== +"@wallet-standard/base@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@wallet-standard/base/-/base-1.0.1.tgz#860dd94d47c9e3c5c43b79d91c6afdbd7a36264e" + integrity sha512-1To3ekMfzhYxe0Yhkpri+Fedq0SYcfrOfJi3vbLjMwF2qiKPjTGLwZkf2C9ftdQmxES+hmxhBzTwF4KgcOwf8w== + +"@wallet-standard/features@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@wallet-standard/features/-/features-1.0.3.tgz#c992876c5e4f7a0672f8869c4146c87e0dfe48c8" + integrity sha512-m8475I6W5LTatTZuUz5JJNK42wFRgkJTB0I9tkruMwfqBF2UN2eomkYNVf9RbrsROelCRzSFmugqjKZBFaubsA== + dependencies: + "@wallet-standard/base" "^1.0.1" + JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1236,6 +1788,27 @@ ajv@^6.10.0, ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +algo-msgpack-with-bigint@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/algo-msgpack-with-bigint/-/algo-msgpack-with-bigint-2.1.1.tgz#38bb717220525b3ff42232eefdcd9efb9ad405d6" + integrity sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ== + +algosdk@^1.13.1: + version "1.24.1" + resolved "https://registry.yarnpkg.com/algosdk/-/algosdk-1.24.1.tgz#afc4102457ae0c38a32de6b84f4d713aedfc9e89" + integrity sha512-9moZxdqeJ6GdE4N6fA/GlUP4LrbLZMYcYkt141J4Ss68OfEgH9qW0wBuZ3ZOKEx/xjc5bg7mLP2Gjg7nwrkmww== + dependencies: + algo-msgpack-with-bigint "^2.1.1" + buffer "^6.0.2" + cross-fetch "^3.1.5" + hi-base32 "^0.5.1" + js-sha256 "^0.9.0" + js-sha3 "^0.8.0" + js-sha512 "^0.8.0" + json-bigint "^1.0.0" + tweetnacl "^1.0.3" + vlq "^2.0.4" + ansi-colors@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" @@ -1290,6 +1863,35 @@ anymatch@^3.0.3, anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +arbundles@^0.6.21: + version "0.6.22" + resolved "https://registry.yarnpkg.com/arbundles/-/arbundles-0.6.22.tgz#0fd58ec76514f1d6c2db7c5870a6232314f52de6" + integrity sha512-QlSavBHk59mNqgQ6ScxlqaBJlDbSmSrK/uTcF3HojLAZ/4aufTkVTBjl1hSfZ/ZN45oIPgJC05R8SmVARF+8VA== + dependencies: + "@noble/ed25519" "^1.6.1" + "@randlabs/myalgo-connect" "^1.1.2" + "@solana/wallet-adapter-base" "^0.9.2" + algosdk "^1.13.1" + arweave "^1.11.4" + arweave-stream-tx "^1.1.0" + avsc "https://github.com/Bundlr-Network/avsc#csp-fixes" + axios "^0.21.3" + base64url "^3.0.1" + bs58 "^4.0.1" + ethers "^5.5.1" + keccak "^3.0.2" + multistream "^4.1.0" + process "^0.11.10" + secp256k1 "^4.0.2" + tmp-promise "^3.0.2" + +arconnect@^0.4.2: + version "0.4.2" + resolved "https://registry.yarnpkg.com/arconnect/-/arconnect-0.4.2.tgz#83de7638fb46183e82d7ec7efb5594c5f7cdc806" + integrity sha512-Jkpd4QL3TVqnd3U683gzXmZUVqBUy17DdJDuL/3D9rkysLgX6ymJ2e+sR+xyZF5Rh42CBqDXWNMmCjBXeP7Gbw== + dependencies: + arweave "^1.10.13" + arg@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" @@ -1327,17 +1929,55 @@ arrify@^1.0.0: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== +arweave-stream-tx@^1.1.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/arweave-stream-tx/-/arweave-stream-tx-1.2.2.tgz#2d5c66554301baacd02586a152fbb198b422112f" + integrity sha512-bNt9rj0hbAEzoUZEF2s6WJbIz8nasZlZpxIw03Xm8fzb9gRiiZlZGW3lxQLjfc9Z0VRUWDzwtqoYeEoB/JDToQ== + dependencies: + exponential-backoff "^3.1.0" + +arweave@^1.10.13, arweave@^1.11.4: + version "1.14.0" + resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.14.0.tgz#a4424455a4137b7708cdc627b5bda1881d6881b5" + integrity sha512-P2g9FjbJZQfk0Q3a5R2aCyPP3jen3ZN6Oxh6p6BlwEGHn5M5O0KvZSaiNV4X/PENgnZA4+afOf9MR3ySGcR3JQ== + dependencies: + arconnect "^0.4.2" + asn1.js "^5.4.1" + base64-js "^1.5.1" + bignumber.js "^9.0.2" + +asn1.js@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" + integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + safer-buffer "^2.1.0" + assertion-error@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== +async-retry@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280" + integrity sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw== + dependencies: + retry "0.13.1" + available-typed-arrays@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -axios@^0.21.1: +"avsc@https://github.com/Bundlr-Network/avsc#csp-fixes": + version "5.4.7" + resolved "https://github.com/Bundlr-Network/avsc#a730cc8018b79e114b6a3381bbb57760a24c6cef" + +axios@^0.21.1, axios@^0.21.3: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== @@ -1428,7 +2068,7 @@ base-x@^4.0.0: resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a" integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw== -base64-js@^1.3.1: +base64-js@^1.3.1, base64-js@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== @@ -1438,6 +2078,16 @@ base64id@2.0.0, base64id@~2.0.0: resolved "https://registry.yarnpkg.com/base64id/-/base64id-2.0.0.tgz#2770ac6bc47d312af97a8bf9a634342e0cd25cb6" integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== +base64url@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" + integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== + +bech32@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + bigint-buffer@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/bigint-buffer/-/bigint-buffer-1.1.5.tgz#d038f31c8e4534c1f8d0015209bf34b4fa6dd442" @@ -1445,7 +2095,7 @@ bigint-buffer@^1.1.5: dependencies: bindings "^1.3.0" -bignumber.js@^9.0.1: +bignumber.js@^9.0.0, bignumber.js@^9.0.1, bignumber.js@^9.0.2: version "9.1.1" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== @@ -1462,16 +2112,72 @@ bindings@^1.3.0: dependencies: file-uri-to-path "1.0.0" +bip39-light@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/bip39-light/-/bip39-light-1.0.7.tgz#06a72f251b89389a136d3f177f29b03342adc5ba" + integrity sha512-WDTmLRQUsiioBdTs9BmSEmkJza+8xfJmptsNJjxnoq3EydSa/ZBXT6rm66KoT3PJIRYMnhSKNR7S9YL1l7R40Q== + dependencies: + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + +bip39@3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.2.tgz#2baf42ff3071fc9ddd5103de92e8f80d9257ee32" + integrity sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ== + dependencies: + "@types/node" "11.11.6" + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + randombytes "^2.0.1" + +bl@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + +blakejs@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + bluebird@3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.2.0, bn.js@^5.2.1: +bn.js@4.11.6: + version "4.11.6" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA== + +bn.js@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" + integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + +bn.js@^4.0.0, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== +borsh@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.6.0.tgz#a7c9eeca6a31ca9e0607cb49f329cb659eb791e1" + integrity sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q== + dependencies: + bn.js "^5.2.0" + bs58 "^4.0.0" + text-encoding-utf-8 "^1.0.2" + borsh@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a" @@ -1503,11 +2209,28 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" +brorand@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== + browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== +browserify-aes@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + browserslist@^4.21.3: version "4.21.4" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" @@ -1539,6 +2262,15 @@ bs58@^5.0.0: dependencies: base-x "^4.0.0" +bs58check@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" + integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== + dependencies: + bs58 "^4.0.0" + create-hash "^1.1.0" + safe-buffer "^5.1.2" + bser@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" @@ -1561,6 +2293,16 @@ buffer-layout@^1.2.0: resolved "https://registry.yarnpkg.com/buffer-layout/-/buffer-layout-1.2.2.tgz#b9814e7c7235783085f9ca4966a0cfff112259d5" integrity sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA== +buffer-reverse@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-reverse/-/buffer-reverse-1.0.1.tgz#49283c8efa6f901bc01fa3304d06027971ae2f60" + integrity sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg== + +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== + buffer@6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.1.tgz#3cbea8c1463e5a0779e30b66d4c88c6ffa182ac2" @@ -1569,7 +2311,7 @@ buffer@6.0.1: base64-js "^1.3.1" ieee754 "^1.2.1" -buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3: +buffer@6.0.3, buffer@^6.0.2, buffer@^6.0.3, buffer@~6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== @@ -1577,6 +2319,14 @@ buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" +buffer@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + bufferutil@^4.0.1: version "4.0.7" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" @@ -1612,6 +2362,11 @@ caniuse-lite@^1.0.30001400: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001436.tgz#22d7cbdbbbb60cdc4ca1030ccd6dea9f5de4848b" integrity sha512-ZmWkKsnC2ifEPoWUvSAIGyOYwT+keAaaWPHiQ9DfMqS1t6tfuyFYoWR78TeZtznkEQ64+vGXH9cZrElwR2Mrxg== +capability@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/capability/-/capability-0.2.5.tgz#51ad87353f1936ffd77f2f21c74633a4dea88801" + integrity sha512-rsJZYVCgXd08sPqwmaIqjAd5SUTfonV0z/gDJ8D6cN8wQphky1kkAYEqQ+hmDxTw7UihvBfjUVUSY+DBEe44jg== + chai@^4.3.4: version "4.3.7" resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" @@ -1634,7 +2389,7 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1647,6 +2402,11 @@ char-regex@^1.0.2: resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + check-error@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" @@ -1677,11 +2437,36 @@ ci-info@^3.2.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.7.0.tgz#6d01b3696c59915b6ce057e4aa4adfc2fa25f5ef" integrity sha512-2CpRNYmImPx+RXKLq6jko/L07phmS9I02TyqkcNU20GCF/GgaWvc58hPtjxDX8lPpkdwc9sNh72V9k00S7ezog== +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + cjs-module-lexer@^1.0.0: version "1.2.2" resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + +cli-spinners@^2.5.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.0.tgz#5881d0ad96381e117bbe07ad91f2008fe6ffd8db" + integrity sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g== + +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -1700,6 +2485,11 @@ cliui@^8.0.1: strip-ansi "^6.0.1" wrap-ansi "^7.0.0" +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -1739,6 +2529,11 @@ commander@^2.20.3: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commander@^8.2.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -1767,6 +2562,29 @@ cors@~2.8.5: object-assign "^4" vary "^1" +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@1.1.7, create-hmac@^1.1.4, create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + cross-fetch@3.0.6: version "3.0.6" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.6.tgz#3a4040bc8941e653e0e9cf17f29ebcd177d3365c" @@ -1774,6 +2592,13 @@ cross-fetch@3.0.6: dependencies: node-fetch "2.6.1" +cross-fetch@^3.1.5: + version "3.1.8" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" + integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== + dependencies: + node-fetch "^2.6.12" + cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -1783,6 +2608,36 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +crypto-js@^3.1.9-1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.3.0.tgz#846dd1cce2f68aacfa156c8578f926a609b7976b" + integrity sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q== + +csv-generate@^4.2.6: + version "4.2.6" + resolved "https://registry.yarnpkg.com/csv-generate/-/csv-generate-4.2.6.tgz#7146b41313d7c91d19d99891ef400d7f0931e908" + integrity sha512-VtnYqhWLcsUocA346ewFOk+rrqcoT663j11vXzD2uelXq9WguQ3QzDeVD8ISso7hhVtkDSHcWl9psdemeiEHDA== + +csv-parse@^5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.4.0.tgz#6793210a4a49a9a74b3fde3f9d00f3f52044fd89" + integrity sha512-JiQosUWiOFgp4hQn0an+SBoV9IKdqzhROM0iiN4LB7UpfJBlsSJlWl9nq4zGgxgMAzHJ6V4t29VAVD+3+2NJAg== + +csv-stringify@^6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-6.4.0.tgz#6d006dca9194700e44f9fbc541bee8bbbd4f459c" + integrity sha512-HQsw0QXiN5fdlO+R8/JzCZnR3Fqp8E87YVnhHlaPtNGJjt6ffbV0LpOkieIb1x6V1+xt878IYq77SpXHWAqKkA== + +csv@^6.0.5: + version "6.3.1" + resolved "https://registry.yarnpkg.com/csv/-/csv-6.3.1.tgz#52fb5d676ea084b2659dacd2b324e420bdd68989" + integrity sha512-ZTcWLvr0Ux0IQDz/QzhCToBVIZtF5GDrStMt9I8mRSk0jPnfF9OeYKz0EZTspaAEOK6hf515ag97nKmwoyU8ZA== + dependencies: + csv-generate "^4.2.6" + csv-parse "^5.4.0" + csv-stringify "^6.4.0" + stream-transform "^3.2.6" + date-fns@^2.28.0: version "2.29.3" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" @@ -1862,6 +2717,13 @@ deepmerge@^4.2.2: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== +defaults@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" + integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== + dependencies: + clone "^1.0.2" + define-properties@^1.1.3, define-properties@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" @@ -1880,6 +2742,16 @@ delay@^5.0.0: resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d" integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw== +depd@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +depd@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== + detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -1949,6 +2821,19 @@ electron-to-chromium@^1.4.251: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592" integrity sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA== +elliptic@6.5.4, elliptic@^6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== + dependencies: + bn.js "^4.11.9" + brorand "^1.1.0" + hash.js "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" + emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" @@ -1998,6 +2883,15 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +error-polyfill@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/error-polyfill/-/error-polyfill-0.1.3.tgz#df848b61ad8834f7a5db69a70b9913df86721d15" + integrity sha512-XHJk60ufE+TG/ydwp4lilOog549iiQF2OAPhkk9DdiYWMrltz5yhDz/xnKuenNwP7gy3dsibssO5QpVhkrSzzg== + dependencies: + capability "^0.2.5" + o3 "^1.0.3" + u3 "^0.1.1" + es-abstract@^1.19.0, es-abstract@^1.20.4: version "1.20.4" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.4.tgz#1d103f9f8d78d4cf0713edcd6d0ed1a46eed5861" @@ -2216,6 +3110,89 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +ethereum-bloom-filters@^1.0.6: + version "1.0.10" + resolved "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz#3ca07f4aed698e75bd134584850260246a5fed8a" + integrity sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA== + dependencies: + js-sha3 "^0.8.0" + +ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== + dependencies: + "@types/pbkdf2" "^3.0.0" + "@types/secp256k1" "^4.0.1" + blakejs "^1.1.0" + browserify-aes "^1.2.0" + bs58check "^2.1.2" + create-hash "^1.2.0" + create-hmac "^1.1.7" + hash.js "^1.1.7" + keccak "^3.0.0" + pbkdf2 "^3.0.17" + randombytes "^2.1.0" + safe-buffer "^5.1.2" + scrypt-js "^3.0.0" + secp256k1 "^4.0.1" + setimmediate "^1.0.5" + +ethereumjs-util@^7.1.0: + version "7.1.5" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" + integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" + +ethers@^5.5.1: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + +ethjs-unit@0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" + integrity sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw== + dependencies: + bn.js "4.11.6" + number-to-bn "1.7.0" + event-stream@=3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" @@ -2234,6 +3211,14 @@ eventemitter3@^4.0.7: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== +evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + execa@5.1.1, execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -2265,6 +3250,20 @@ expect@^29.0.0, expect@^29.3.1: jest-message-util "^29.3.1" jest-util "^29.3.1" +exponential-backoff@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.1.tgz#64ac7526fe341ab18a39016cd22c787d01e00bf6" + integrity sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw== + +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + eyes@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" @@ -2320,6 +3319,13 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +figures@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" + integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -2595,16 +3601,58 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + he@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +hi-base32@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/hi-base32/-/hi-base32-0.5.1.tgz#1279f2ddae2673219ea5870c2121d2a33132857e" + integrity sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA== + +hmac-drbg@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== +http-errors@^1.7.2: + version "1.8.1" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" + integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== + dependencies: + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.1" + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -2656,11 +3704,32 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +inquirer@^8.2.0: + version "8.2.5" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.5.tgz#d8654a7542c35a9b9e069d27e2df4858784d54f8" + integrity sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^4.1.1" + cli-cursor "^3.1.0" + cli-width "^3.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.21" + mute-stream "0.0.8" + ora "^5.4.1" + run-async "^2.4.0" + rxjs "^7.5.5" + string-width "^4.1.0" + strip-ansi "^6.0.0" + through "^2.3.6" + wrap-ansi "^7.0.0" + internal-slot@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" @@ -2746,6 +3815,16 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" +is-hex-prefixed@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" + integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== + +is-interactive@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" + integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== + is-map@^2.0.1, is-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" @@ -3416,11 +4495,16 @@ js-sha256@^0.9.0: resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966" integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA== -js-sha3@^0.8.0: +js-sha3@0.8.0, js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== +js-sha512@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.8.0.tgz#dd22db8d02756faccf19f218e3ed61ec8249f7d4" + integrity sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ== + js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -3446,6 +4530,13 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -3488,6 +4579,15 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== +keccak@^3.0.0, keccak@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.3.tgz#4bc35ad917be1ef54ff246f904c2bbbf9ac61276" + integrity sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -3530,6 +4630,16 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + lodash.memoize@4.x: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -3545,7 +4655,7 @@ lodash@^4.17.20, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@4.1.0: +log-symbols@4.1.0, log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -3608,6 +4718,15 @@ marked@^4.0.19: resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.3.tgz#bd76a5eb510ff1d8421bc6c3b2f0b93488c15bea" integrity sha512-slWRdJkbTZ+PjkyJnE30Uid64eHwbwa1Q25INCAYfZlK4o6ylagBy/Le9eWntqJFoFT93ikUKMv47GZ4gTwHkw== +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -3618,6 +4737,17 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +merkletreejs@^0.2.32: + version "0.2.32" + resolved "https://registry.yarnpkg.com/merkletreejs/-/merkletreejs-0.2.32.tgz#cf1c0760e2904e4a1cc269108d6009459fd06223" + integrity sha512-TostQBiwYRIwSE5++jGmacu3ODcKAgqb0Y/pnIohXS7sWxh1gCkSptbmF1a43faehRDpcHf7J/kv0Ml2D/zblQ== + dependencies: + bignumber.js "^9.0.1" + buffer-reverse "^1.0.1" + crypto-js "^3.1.9-1" + treeify "^1.1.0" + web3-utils "^1.3.4" + micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" @@ -3631,18 +4761,33 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@~2.1.34: +mime-types@^2.1.34, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: mime-db "1.52.0" +mime@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7" + integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== + mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== + minimatch@4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.1.tgz#40d9d511a46bdc4e563c22c3080cde9c0d8299b4" @@ -3716,6 +4861,24 @@ ms@2.1.3, ms@^2.0.0: resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +multistream@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/multistream/-/multistream-4.1.0.tgz#7bf00dfd119556fbc153cff3de4c6d477909f5a8" + integrity sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw== + dependencies: + once "^1.4.0" + readable-stream "^3.6.0" + +mustache@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== + +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + nanoid@3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35" @@ -3731,6 +4894,42 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +near-api-js@^0.44.2: + version "0.44.2" + resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-0.44.2.tgz#e451f68f2c56bd885c7b918db5818a3e6e9423d0" + integrity sha512-eMnc4V+geggapEUa3nU2p8HSHn/njtloI4P2mceHQWO8vDE1NGpnAw8FuTBrLmXSgIv9m6oocgFc9t3VNf5zwg== + dependencies: + bn.js "5.2.0" + borsh "^0.6.0" + bs58 "^4.0.0" + depd "^2.0.0" + error-polyfill "^0.1.3" + http-errors "^1.7.2" + js-sha256 "^0.9.0" + mustache "^4.0.0" + node-fetch "^2.6.1" + text-encoding-utf-8 "^1.0.2" + tweetnacl "^1.0.1" + +near-hd-key@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/near-hd-key/-/near-hd-key-1.2.1.tgz#f508ff15436cf8a439b543220f3cc72188a46756" + integrity sha512-SIrthcL5Wc0sps+2e1xGj3zceEa68TgNZDLuCx0daxmfTP7sFTB3/mtE2pYhlFsCxWoMn+JfID5E1NlzvvbRJg== + dependencies: + bip39 "3.0.2" + create-hmac "1.1.7" + tweetnacl "1.0.3" + +near-seed-phrase@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/near-seed-phrase/-/near-seed-phrase-0.2.0.tgz#fb7cf89682112b1160ab68abb50dc821f49be18a" + integrity sha512-NpmrnejpY1AdlRpDZ0schJQJtfBaoUheRfiYtQpcq9TkwPgqKZCRULV5L3hHmLc0ep7KRtikbPQ9R2ztN/3cyQ== + dependencies: + bip39-light "^1.0.7" + bs58 "^4.0.1" + near-hd-key "^1.2.1" + tweetnacl "^1.0.2" + negotiator@0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" @@ -3749,6 +4948,11 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + node-fetch@2: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -3795,11 +4999,26 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" +number-to-bn@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz#bb3623592f7e5f9e0030b1977bd41a0c53fe1ea0" + integrity sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig== + dependencies: + bn.js "4.11.6" + strip-hex-prefix "1.0.0" + numeral@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/numeral/-/numeral-2.0.6.tgz#4ad080936d443c2561aed9f2197efffe25f4e506" integrity sha512-qaKRmtYPZ5qdw4jWJD6bxEf1FJEqllJrwxCLIm0sQU/A7v2/czigzOb+C2uSiFsa9lBUzeH7M1oK+Q+OLxL3kA== +o3@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/o3/-/o3-1.0.3.tgz#192ce877a882dfa6751f0412a865fafb2da1dac0" + integrity sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ== + dependencies: + capability "^0.2.5" + object-assign@^4: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -3833,14 +5052,14 @@ object.assign@^4.1.4: has-symbols "^1.0.3" object-keys "^1.1.1" -once@^1.3.0: +once@^1.3.0, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" -onetime@^5.1.2: +onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -3859,6 +5078,26 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" +ora@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" + integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== + dependencies: + bl "^4.1.0" + chalk "^4.1.0" + cli-cursor "^3.1.0" + cli-spinners "^2.5.0" + is-interactive "^1.0.0" + is-unicode-supported "^0.1.0" + log-symbols "^4.1.0" + strip-ansi "^6.0.0" + wcwidth "^1.0.1" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -3946,6 +5185,17 @@ pause-stream@0.0.11: dependencies: through "~2.3" +pbkdf2@^3.0.17, pbkdf2@^3.0.9: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" + integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -4011,6 +5261,11 @@ pretty-format@^29.0.0, pretty-format@^29.3.1: ansi-styles "^5.0.0" react-is "^18.0.0" +process@^0.11.10: + version "0.11.10" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== + prompts@^2.0.1: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -4036,7 +5291,7 @@ queue-microtask@^1.2.2: resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -randombytes@^2.1.0: +randombytes@^2.0.1, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== @@ -4053,6 +5308,15 @@ react-is@^18.0.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== +readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -4129,6 +5393,14 @@ resolve@^2.0.0-next.3: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + resumer@^0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" @@ -4136,18 +5408,38 @@ resumer@^0.0.0: dependencies: through "~2.3.4" +retry@0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" + integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@^3.0.2: +rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rlp@^2.2.4: + version "2.2.7" + resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" + integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== + dependencies: + bn.js "^5.2.0" + rpc-websockets@^7.5.0: version "7.5.0" resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.5.0.tgz#bbeb87572e66703ff151e50af1658f98098e2748" @@ -4188,7 +5480,14 @@ rxjs@^7.1.0, rxjs@^7.5.4: dependencies: tslib "^2.1.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0: +rxjs@^7.5.5: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -4202,6 +5501,25 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +scrypt-js@3.0.1, scrypt-js@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +secp256k1@^4.0.1, secp256k1@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" + integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== + dependencies: + elliptic "^6.5.4" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + selective-whitespace@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/selective-whitespace/-/selective-whitespace-1.0.4.tgz#02d428b46b2c770398be9a538eb442b1e842fc5c" @@ -4228,6 +5546,24 @@ serialize-javascript@6.0.0: dependencies: randombytes "^2.1.0" +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -4258,7 +5594,7 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -4377,6 +5713,11 @@ start-server-and-test@^1.14.0: ps-tree "1.2.0" wait-on "6.0.0" +"statuses@>= 1.5.0 < 2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== + stream-combiner@~0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14" @@ -4384,6 +5725,11 @@ stream-combiner@~0.0.4: dependencies: duplexer "~0.1.1" +stream-transform@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/stream-transform/-/stream-transform-3.2.6.tgz#7caeaaf68d2bf94fc412a520f2deb3c49b3bc0ab" + integrity sha512-/pyOvaCQFqYTmrFhmMbnAEVo3SsTx1H39eUVPOtYeAgbEUc+rDo7GoP8LbHJgU83mKtzJe/7Nq/ipaAnUOHgJQ== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -4428,6 +5774,13 @@ string.prototype.trimstart@^1.0.5: define-properties "^1.1.4" es-abstract "^1.20.4" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -4450,6 +5803,13 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-hex-prefix@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" + integrity sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A== + dependencies: + is-hex-prefixed "1.0.0" + strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -4532,7 +5892,7 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -through@2, "through@>=2.2.7 <3", through@^2.3.8, through@~2.3, through@~2.3.1, through@~2.3.4: +through@2, "through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8, through@~2.3, through@~2.3.1, through@~2.3.4: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== @@ -4542,6 +5902,27 @@ timeago.js@^4.0.2: resolved "https://registry.yarnpkg.com/timeago.js/-/timeago.js-4.0.2.tgz#724e8c8833e3490676c7bb0a75f5daf20e558028" integrity sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w== +tmp-promise@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-3.0.3.tgz#60a1a1cc98c988674fcbfd23b6e3367bdeac4ce7" + integrity sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ== + dependencies: + tmp "^0.2.0" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +tmp@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== + dependencies: + rimraf "^3.0.0" + tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -4559,6 +5940,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + tokenize-whitespace@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tokenize-whitespace/-/tokenize-whitespace-0.0.1.tgz#3c207ab58948113225246285200563e3b4b5c6ff" @@ -4574,6 +5960,11 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== +treeify@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/treeify/-/treeify-1.1.0.tgz#4e31c6a463accd0943879f30667c4fdaff411bb8" + integrity sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A== + ts-essentials@^9.3.0: version "9.3.0" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-9.3.0.tgz#7e639c1a76b1805c3c60d6e1b5178da2e70aea02" @@ -4650,7 +6041,7 @@ tsutils@^3.21.0: dependencies: tslib "^1.8.1" -tweetnacl@^1.0.3: +tweetnacl@1.0.3, tweetnacl@^1.0.1, tweetnacl@^1.0.2, tweetnacl@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== @@ -4697,6 +6088,11 @@ typescript@^4.3.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== +u3@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/u3/-/u3-0.1.1.tgz#5f52044f42ee76cd8de33148829e14528494b73b" + integrity sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w== + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -4729,6 +6125,16 @@ utf-8-validate@^5.0.2: dependencies: node-gyp-build "^4.3.0" +utf8@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" @@ -4748,6 +6154,11 @@ vary@^1: resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== +vlq@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-2.0.4.tgz#6057b85729245b9829e3cc7755f95b228d4fe041" + integrity sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA== + vscode-oniguruma@^1.6.1: version "1.7.0" resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" @@ -4787,6 +6198,26 @@ walker@^1.0.7, walker@^1.0.8: dependencies: makeerror "1.0.12" +wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== + dependencies: + defaults "^1.0.3" + +web3-utils@^1.3.4: + version "1.10.0" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.10.0.tgz#ca4c1b431a765c14ac7f773e92e0fd9377ccf578" + integrity sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg== + dependencies: + bn.js "^5.2.1" + ethereum-bloom-filters "^1.0.6" + ethereumjs-util "^7.1.0" + ethjs-unit "0.1.6" + number-to-bn "1.7.0" + randombytes "^2.1.0" + utf8 "3.0.0" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -4872,6 +6303,11 @@ write-file-atomic@^4.0.1: imurmurhash "^0.1.4" signal-exit "^3.0.7" +ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + ws@^7.4.5: version "7.5.9" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" diff --git a/clients/js/src/generated/instructions/updateMetadata.ts b/clients/js/src/generated/instructions/updateMetadata.ts index c6b04fcf..ff336df3 100644 --- a/clients/js/src/generated/instructions/updateMetadata.ts +++ b/clients/js/src/generated/instructions/updateMetadata.ts @@ -45,7 +45,7 @@ import { // Accounts. export type UpdateMetadataInstructionAccounts = { - oldMetadata?: PublicKey | Pda; + oldMetadataAcct?: PublicKey | Pda; treeAuthority?: PublicKey | Pda; treeDelegate: Signer; collectionAuthority: PublicKey | Pda; @@ -144,8 +144,7 @@ export type UpdateMetadataInstructionArgs = UpdateMetadataInstructionDataArgs; // Instruction. export function updateMetadata( context: Pick, - accounts: UpdateMetadataInstructionAccounts, - args: UpdateMetadataInstructionArgs + input: UpdateMetadataInstructionAccounts & UpdateMetadataInstructionArgs ): TransactionBuilder { const signers: Signer[] = []; const keys: AccountMeta[] = []; @@ -158,34 +157,34 @@ export function updateMetadata( // Resolved inputs. const resolvedAccounts = { - treeDelegate: [accounts.treeDelegate, false] as const, - collectionAuthority: [accounts.collectionAuthority, false] as const, - collectionMint: [accounts.collectionMint, false] as const, - collectionMetadata: [accounts.collectionMetadata, false] as const, + treeDelegate: [input.treeDelegate, false] as const, + collectionAuthority: [input.collectionAuthority, false] as const, + collectionMint: [input.collectionMint, false] as const, + collectionMetadata: [input.collectionMetadata, false] as const, collectionAuthorityRecordPda: [ - accounts.collectionAuthorityRecordPda, + input.collectionAuthorityRecordPda, false, ] as const, - leafOwner: [accounts.leafOwner, false] as const, - leafDelegate: [accounts.leafDelegate, false] as const, - merkleTree: [accounts.merkleTree, true] as const, + leafOwner: [input.leafOwner, false] as const, + leafDelegate: [input.leafDelegate, false] as const, + merkleTree: [input.merkleTree, true] as const, }; const resolvingArgs = {}; addObjectProperty( resolvedAccounts, - 'oldMetadata', - accounts.oldMetadata - ? ([accounts.oldMetadata, false] as const) + 'oldMetadataAcct', + input.oldMetadataAcct + ? ([input.oldMetadataAcct, false] as const) : ([programId, false] as const) ); addObjectProperty( resolvedAccounts, 'treeAuthority', - accounts.treeAuthority - ? ([accounts.treeAuthority, false] as const) + input.treeAuthority + ? ([input.treeAuthority, false] as const) : ([ findTreeConfigPda(context, { - merkleTree: publicKey(accounts.merkleTree, false), + merkleTree: publicKey(input.merkleTree, false), }), false, ] as const) @@ -193,15 +192,15 @@ export function updateMetadata( addObjectProperty( resolvedAccounts, 'payer', - accounts.payer - ? ([accounts.payer, false] as const) + input.payer + ? ([input.payer, false] as const) : ([context.payer, false] as const) ); addObjectProperty( resolvedAccounts, 'logWrapper', - accounts.logWrapper - ? ([accounts.logWrapper, false] as const) + input.logWrapper + ? ([input.logWrapper, false] as const) : ([ context.programs.getPublicKey( 'splNoop', @@ -213,8 +212,8 @@ export function updateMetadata( addObjectProperty( resolvedAccounts, 'compressionProgram', - accounts.compressionProgram - ? ([accounts.compressionProgram, false] as const) + input.compressionProgram + ? ([input.compressionProgram, false] as const) : ([ context.programs.getPublicKey( 'splAccountCompression', @@ -226,8 +225,8 @@ export function updateMetadata( addObjectProperty( resolvedAccounts, 'tokenMetadataProgram', - accounts.tokenMetadataProgram - ? ([accounts.tokenMetadataProgram, false] as const) + input.tokenMetadataProgram + ? ([input.tokenMetadataProgram, false] as const) : ([ context.programs.getPublicKey( 'mplTokenMetadata', @@ -239,8 +238,8 @@ export function updateMetadata( addObjectProperty( resolvedAccounts, 'systemProgram', - accounts.systemProgram - ? ([accounts.systemProgram, false] as const) + input.systemProgram + ? ([input.systemProgram, false] as const) : ([ context.programs.getPublicKey( 'splSystem', @@ -249,9 +248,9 @@ export function updateMetadata( false, ] as const) ); - const resolvedArgs = { ...args, ...resolvingArgs }; + const resolvedArgs = { ...input, ...resolvingArgs }; - addAccountMeta(keys, signers, resolvedAccounts.oldMetadata, false); + addAccountMeta(keys, signers, resolvedAccounts.oldMetadataAcct, false); addAccountMeta(keys, signers, resolvedAccounts.treeAuthority, false); addAccountMeta(keys, signers, resolvedAccounts.treeDelegate, false); addAccountMeta(keys, signers, resolvedAccounts.collectionAuthority, false); diff --git a/idls/bubblegum.json b/idls/bubblegum.json index 9ac8d6c0..7e8f6af3 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1086,8 +1086,151 @@ { "name": "updateMetadata", "accounts": [ + { + "name": "oldMetadataAcct", + "isMut": false, + "isSigner": false, + "isOptional": true + }, + { + "name": "treeAuthority", + "isMut": false, + "isSigner": false, + "pda": { + "seeds": [ + { + "kind": "account", + "type": "publicKey", + "path": "merkle_tree" + } + ] + } + }, + { + "name": "treeDelegate", + "isMut": false, + "isSigner": true + }, + { + "name": "leafOwner", + "isMut": false, + "isSigner": false + }, + { + "name": "leafDelegate", + "isMut": false, + "isSigner": false + }, + { + "name": "payer", + "isMut": false, + "isSigner": true + }, + { + "name": "merkleTree", + "isMut": true, + "isSigner": false + }, + { + "name": "logWrapper", + "isMut": false, + "isSigner": false + }, + { + "name": "compressionProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "tokenMetadataProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "systemProgram", + "isMut": false, + "isSigner": false + } + ], + "args": [ + { + "name": "root", + "type": { + "array": [ + "u8", + 32 + ] + } + }, { "name": "oldMetadata", + "type": { + "option": { + "defined": "MetadataArgs" + } + } + }, + { + "name": "newName", + "type": { + "option": "string" + } + }, + { + "name": "newSymbol", + "type": { + "option": "string" + } + }, + { + "name": "newUri", + "type": { + "option": "string" + } + }, + { + "name": "newCreators", + "type": { + "option": { + "vec": { + "defined": "Creator" + } + } + } + }, + { + "name": "newSellerFeeBasisPoints", + "type": { + "option": "u16" + } + }, + { + "name": "newPrimarySaleHappened", + "type": { + "option": "bool" + } + }, + { + "name": "newIsMutable", + "type": { + "option": "bool" + } + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "index", + "type": "u32" + } + ] + }, + { + "name": "updateMetadataCollectionNft", + "accounts": [ + { + "name": "oldMetadataAcct", "isMut": false, "isSigner": false, "isOptional": true @@ -1114,22 +1257,35 @@ { "name": "collectionAuthority", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "This account is only required if the NFT is part of a collection" + ] }, { "name": "collectionMint", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "This account is only required if the NFT is part of a collection" + ] }, { "name": "collectionMetadata", "isMut": false, - "isSigner": false + "isSigner": false, + "docs": [ + "This account is only required if the NFT is part of a collection" + ] }, { "name": "collectionAuthorityRecordPda", "isMut": false, - "isSigner": false + "isSigner": false, + "isOptional": true, + "docs": [ + "This account is only required if the NFT is part of a collection" + ] }, { "name": "leafOwner", @@ -2169,6 +2325,11 @@ "code": 6038, "name": "MissingCollectionAuthoritySignature", "msg": "Missing Collection Authority Signature" + }, + { + "code": 6039, + "name": "NFTLinkedToCollection", + "msg": "NFT linked to collection" } ], "metadata": { diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index f4610ed9..bd135232 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -80,8 +80,8 @@ pub enum BubblegumError { MetadataArgsAmbiguous, #[msg("MetadataArgs Missing")] MetadataArgsMissing, - #[msg("Missing Collection Authority Signature")] - MissingCollectionAuthoritySignature, + #[msg("NFT linked to collection")] + NFTLinkedToCollection, } // Converts certain Token Metadata errors into Bubblegum equivalents diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 83b459d8..36a6a119 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -5,7 +5,7 @@ use crate::{ error::{metadata_error_into_bubblegum, BubblegumError}, state::{ leaf_schema::LeafSchema, - metaplex_adapter::{self, Creator, MetadataArgs, TokenProgramVersion}, + metaplex_adapter::{self, Creator, MetadataArgs, TokenProgramVersion, Collection}, metaplex_anchor::{MasterEdition, MplTokenMetadata, TokenMetadata}, DecompressableState, TreeConfig, Voucher, ASSET_PREFIX, COLLECTION_CPI_PREFIX, TREE_AUTHORITY_SIZE, VOUCHER_PREFIX, VOUCHER_SIZE, @@ -255,7 +255,7 @@ pub struct Delegate<'info> { pub struct UpdateMetadata<'info> { /// CHECK: Can optionally specify the old_metadata of the leaf through an account to save transaction space /// CHECK: This account is checked in the instruction - pub old_metadata: Option>, + pub old_metadata_acct: Option>, #[account( seeds = [merkle_tree.key().as_ref()], bump, @@ -264,12 +264,42 @@ pub struct UpdateMetadata<'info> { pub tree_authority: Account<'info, TreeConfig>, pub tree_delegate: Signer<'info>, /// CHECK: This account is checked in the instruction + pub leaf_owner: UncheckedAccount<'info>, + /// CHECK: This account is chekced in the instruction + pub leaf_delegate: UncheckedAccount<'info>, + pub payer: Signer<'info>, + #[account(mut)] + /// CHECK: This account is modified in the downstream program + pub merkle_tree: UncheckedAccount<'info>, + pub log_wrapper: Program<'info, Noop>, + pub compression_program: Program<'info, SplAccountCompression>, + pub token_metadata_program: Program<'info, MplTokenMetadata>, + pub system_program: Program<'info, System>, +} + +#[derive(Accounts)] +pub struct UpdateMetadataCollectionNFT<'info> { + /// CHECK: Can optionally specify the old_metadata of the leaf through an account to save transaction space + /// CHECK: This account is checked in the instruction + pub old_metadata_acct: Option>, + #[account( + seeds = [merkle_tree.key().as_ref()], + bump, + )] + /// CHECK: This account is neither written to nor read from. + pub tree_authority: Account<'info, TreeConfig>, + pub tree_delegate: Signer<'info>, + /// This account is only required if the NFT is part of a collection + /// CHECK: This account is checked in the instruction pub collection_authority: UncheckedAccount<'info>, + /// This account is only required if the NFT is part of a collection /// CHECK: This account is checked in the instruction pub collection_mint: UncheckedAccount<'info>, + /// This account is only required if the NFT is part of a collection pub collection_metadata: Box>, + /// This account is only required if the NFT is part of a collection /// CHECK: This account is checked in the instruction - pub collection_authority_record_pda: UncheckedAccount<'info>, + pub collection_authority_record_pda: Option>, /// CHECK: This account is checked in the instruction pub leaf_owner: UncheckedAccount<'info>, /// CHECK: This account is chekced in the instruction @@ -509,6 +539,7 @@ pub enum InstructionName { MintToCollectionV1, SetDecompressableState, UpdateMetadata, + UpdateMetadataCollectionNft } pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { @@ -535,7 +566,7 @@ pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { [235, 242, 121, 216, 158, 234, 180, 234] => InstructionName::SetAndVerifyCollection, [37, 232, 198, 199, 64, 102, 128, 49] => InstructionName::SetDecompressableState, [170, 182, 43, 239, 97, 78, 225, 186] => InstructionName::UpdateMetadata, - + [244, 12, 175, 194, 227, 28, 102, 215] => InstructionName::UpdateMetadataCollectionNft, _ => InstructionName::Unknown, } } @@ -923,6 +954,197 @@ fn process_collection_verification<'info>( ) } +fn assert_signed_by_tree_delegate<'info>( + tree_config: &TreeConfig, + incoming_signer: &Signer<'info> +) -> Result<()> { + if !tree_config.is_public { + require!( + incoming_signer.key() == tree_config.tree_creator || incoming_signer.key() == tree_config.tree_delegate, + BubblegumError::TreeAuthorityIncorrect, + ); + } + return Ok(()) +} + +fn fetch_old_metadata_args<'info>( + old_metadata_arg: Option, + old_metadata_acct: &Option>, +) -> Result { + let old_metadata = match old_metadata_arg { + Some(metadata) => { + require!( + old_metadata_acct.is_none(), + BubblegumError::MetadataArgsAmbiguous + ); + metadata + } + None => { + require!( + old_metadata_acct.is_some(), + BubblegumError::MetadataArgsMissing + ); + let old_metadata_account = old_metadata_acct.as_ref().unwrap(); + let old_metadata_data = old_metadata_account.try_borrow_mut_data()?; + let mut old_metadata_data_slice = old_metadata_data.as_ref(); + MetadataArgs::deserialize(&mut old_metadata_data_slice)? + } + }; + Ok(old_metadata) +} + +fn assert_collection_authority_signed_if_required<'info>( + collection: &Collection, + collection_authority: &AccountInfo<'info>, + collection_authority_record_pda: &Option>, + collection_mint: &AccountInfo<'info>, + collection_metadata_account_info: &AccountInfo, + collection_metadata: &TokenMetadata, + token_metadata_program: &Program<'info, MplTokenMetadata> +) -> Result<()> { + // NFTs linked to unverified collections do not require collection authority signatures + if !collection.verified { + return Ok(()) + } + // Mint account must match Collection mint + require!( + collection_mint.key() == collection.key, + BubblegumError::CollectionMismatch + ); + // Verify correct account ownerships. + require!( + *collection_metadata_account_info.owner == token_metadata_program.key(), + BubblegumError::IncorrectOwner + ); + // Collection mint must be owned by SPL token + require!( + *collection_mint.owner == spl_token::id(), + BubblegumError::IncorrectOwner + ); + + let collection_authority_record = match &collection_authority_record_pda { + None => None, + Some(authority_record_pda) => { + Some(authority_record_pda.to_account_info()) + } + }; + + // Assert that the correct Collection Authority was provided using token-metadata + assert_has_collection_authority( + &collection_authority, + &collection_metadata, + collection_mint.key, + collection_authority_record.as_ref(), + )?; + + Ok(()) +} + +fn process_update_metadata<'info, 'a>( + merkle_tree: &AccountInfo<'info>, + owner: &AccountInfo<'info>, + delegate: &AccountInfo<'info>, + compression_program: &AccountInfo<'info>, + tree_authority: &AccountInfo<'info>, + tree_authority_bump: u8, + log_wrapper: &Program<'info, Noop>, + remaining_accounts: &'a [AccountInfo<'info>], + root: [u8; 32], + old_metadata: MetadataArgs, + new_name: Option, + new_symbol: Option, + new_uri: Option, + new_creators: Option>, + new_seller_fee_basis_points: Option, + new_primary_sale_happened: Option, + new_is_mutable: Option, + nonce: u64, + index: u32, +) -> Result<()> { + // Old metadata must be mutable to allow metadata update + require!(old_metadata.is_mutable, BubblegumError::MetadataImmutable); + + let old_data_hash = hash_metadata(&old_metadata)?; + let old_creator_hash = hash_creators(&old_metadata.creators)?; + + // Update metadata + let mut new_metadata = old_metadata; + if let Some(name) = new_name { + new_metadata.name = name; + }; + if let Some(symbol) = new_symbol { + new_metadata.symbol = symbol; + }; + if let Some(uri) = new_uri { + new_metadata.uri = uri; + }; + if let Some(creators) = new_creators { + let old_creators = new_metadata.creators; + let no_new_creators_were_verified = creators + .iter() + .filter(|c| c.verified) // select only creators that are verified + .all(|c| { + old_creators + .iter() + .any(|old| old.address == c.address && old.verified) + }); + require!( + no_new_creators_were_verified, + BubblegumError::CreatorDidNotVerify + ); + new_metadata.creators = creators; + } + if let Some(seller_fee_basis_points) = new_seller_fee_basis_points { + new_metadata.seller_fee_basis_points = seller_fee_basis_points + }; + if let Some(primary_sale_happened) = new_primary_sale_happened { + if !new_metadata.primary_sale_happened { + new_metadata.primary_sale_happened = primary_sale_happened + } + }; + if let Some(is_mutable) = new_is_mutable { + new_metadata.is_mutable = is_mutable; + }; + + assert_metadata_is_mpl_compatible(&new_metadata)?; + let new_data_hash = hash_metadata(&new_metadata)?; + let new_creator_hash = hash_creators(&new_metadata.creators)?; + + let asset_id = get_asset_id(&merkle_tree.key(), nonce); + let previous_leaf = LeafSchema::new_v0( + asset_id, + owner.key(), + delegate.key(), + nonce, + old_data_hash, + old_creator_hash, + ); + let new_leaf = LeafSchema::new_v0( + asset_id, + owner.key(), + delegate.key(), + nonce, + new_data_hash, + new_creator_hash, + ); + + wrap_application_data_v1(new_leaf.to_event().try_to_vec()?, log_wrapper)?; + + replace_leaf( + &merkle_tree.key(), + tree_authority_bump, + compression_program, + tree_authority, + merkle_tree, + &log_wrapper.to_account_info(), + remaining_accounts, + root, + previous_leaf.to_node(), + new_leaf.to_node(), + index, + ) +} + #[program] pub mod bubblegum { use state::DecompressableState; @@ -1383,8 +1605,8 @@ pub mod bubblegum { ) } - pub fn update_metadata<'info>( - ctx: Context<'_, '_, '_, 'info, UpdateMetadata<'info>>, + pub fn update_metadata<'info, 'a>( + ctx: Context<'_, '_, 'a, 'info, UpdateMetadata<'info>>, root: [u8; 32], old_metadata: Option, new_name: Option, @@ -1397,173 +1619,87 @@ pub mod bubblegum { nonce: u64, index: u32, ) -> Result<()> { - let merkle_tree = ctx.accounts.merkle_tree.to_account_info(); - let owner = ctx.accounts.leaf_owner.to_account_info(); - let delegate = ctx.accounts.leaf_delegate.to_account_info(); - let incoming_tree_delegate = ctx.accounts.tree_delegate.key(); - let authority = &mut ctx.accounts.tree_authority; - let tree_creator = authority.tree_creator; - let tree_delegate = authority.tree_delegate; - if !authority.is_public { - require!( - incoming_tree_delegate == tree_creator || incoming_tree_delegate == tree_delegate, - BubblegumError::TreeAuthorityIncorrect, - ); - } + assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; // Determine how the user opted to pass in the old MetadataArgs - let old_metadata = match old_metadata { - Some(metadata) => { - require!( - ctx.accounts.old_metadata.is_none(), - BubblegumError::MetadataArgsAmbiguous - ); - metadata - } - None => { - require!( - ctx.accounts.old_metadata.is_some(), - BubblegumError::MetadataArgsMissing - ); - let old_metadata_account = ctx.accounts.old_metadata.as_ref().unwrap(); - let old_metadata_data = old_metadata_account.try_borrow_mut_data()?; - let mut old_metadata_data_slice = old_metadata_data.as_ref(); - MetadataArgs::deserialize(&mut old_metadata_data_slice)? - } - }; - - // Old metadata must be mutable to allow metadata update - require!(old_metadata.is_mutable, BubblegumError::MetadataImmutable); - - // If the NFT is a verified part of a collection, then ensure a collection authority - // has signed the tx to confirm the metadata update. - if let Some(collection) = &old_metadata.collection { - if collection.verified { - // Verified collection must match Collection account - require!( - ctx.accounts.collection_mint.key() == collection.key, - BubblegumError::CollectionMismatch - ); - - // Since this NFT is part of a verified collection, require that a CollectionAuthority signed - require!( - ctx.accounts.collection_authority.is_signer, - BubblegumError::MissingCollectionAuthoritySignature - ); - - let collection_mint = ctx.accounts.collection_mint.to_account_info(); - let collection_authority_record_pda = ctx - .accounts - .collection_authority_record_pda - .to_account_info(); - let token_metadata_program = ctx.accounts.token_metadata_program.to_account_info(); - - // Verify correct account ownerships. - require!( - *ctx.accounts.collection_metadata.to_account_info().owner == token_metadata_program.key(), - BubblegumError::IncorrectOwner - ); - require!( - *collection_mint.owner == spl_token::id(), - BubblegumError::IncorrectOwner - ); - - // Get collection_authority_record, if provided - let collection_authority_record = if collection_authority_record_pda.key() == crate::id() { - None - } else { - Some(&collection_authority_record_pda) - }; - - // Assert that the correct Collection Authority was provided using token-metadata - assert_has_collection_authority( - &ctx.accounts.collection_authority.to_account_info(), - &ctx.accounts.collection_metadata, - collection_mint.key, - collection_authority_record, - )?; - } - } - - let old_data_hash = hash_metadata(&old_metadata)?; - let old_creator_hash = hash_creators(&old_metadata.creators)?; - - // Update metadata - let mut new_metadata = old_metadata; - if let Some(name) = new_name { - new_metadata.name = name; - }; - if let Some(symbol) = new_symbol { - new_metadata.symbol = symbol; - }; - if let Some(uri) = new_uri { - new_metadata.uri = uri; - }; - if let Some(creators) = new_creators { - let old_creators = new_metadata.creators; - let no_creators_were_verified = creators - .iter() - .filter(|c| c.verified) // select only creators that are verified - .all(|c| { - old_creators - .iter() - .any(|old| old.address == c.address && old.verified) - }); - require!( - no_creators_were_verified, - BubblegumError::CreatorDidNotVerify - ); - new_metadata.creators = creators; - } - if let Some(seller_fee_basis_points) = new_seller_fee_basis_points { - new_metadata.seller_fee_basis_points = seller_fee_basis_points - }; - if let Some(primary_sale_happened) = new_primary_sale_happened { - if !new_metadata.primary_sale_happened { - new_metadata.primary_sale_happened = primary_sale_happened - } - }; - if let Some(is_mutable) = new_is_mutable { - new_metadata.is_mutable = is_mutable; - }; + let old_metadata = fetch_old_metadata_args(old_metadata, &ctx.accounts.old_metadata_acct)?; - assert_metadata_is_mpl_compatible(&new_metadata)?; - let new_data_hash = hash_metadata(&new_metadata)?; - let new_creator_hash = hash_creators(&new_metadata.creators)?; + // NFTs which are linked to collections cannot be updated through this instruction + require!(old_metadata.collection.is_none(), BubblegumError::NFTLinkedToCollection); - let asset_id = get_asset_id(&merkle_tree.key(), nonce); - let previous_leaf = LeafSchema::new_v0( - asset_id, - owner.key(), - delegate.key(), - nonce, - old_data_hash, - old_creator_hash, - ); - let new_leaf = LeafSchema::new_v0( - asset_id, - owner.key(), - delegate.key(), + process_update_metadata( + &ctx.accounts.merkle_tree.to_account_info(), + &ctx.accounts.leaf_owner, + &ctx.accounts.leaf_delegate, + &ctx.accounts.compression_program.to_account_info(), + &ctx.accounts.tree_authority.to_account_info(), + *ctx.bumps.get("tree_authority").unwrap(), + &ctx.accounts.log_wrapper, + &ctx.remaining_accounts, + root, + old_metadata, + new_name, + new_symbol, + new_uri, + new_creators, + new_seller_fee_basis_points, + new_primary_sale_happened, + new_is_mutable, nonce, - new_data_hash, - new_creator_hash, - ); + index) + } - wrap_application_data_v1(new_leaf.to_event().try_to_vec()?, &ctx.accounts.log_wrapper)?; + pub fn update_metadata_collection_nft<'info, 'a>( + ctx: Context<'_, '_, 'a, 'info, UpdateMetadataCollectionNFT<'info>>, + root: [u8; 32], + old_metadata: Option, + new_name: Option, + new_symbol: Option, + new_uri: Option, + new_creators: Option>, + new_seller_fee_basis_points: Option, + new_primary_sale_happened: Option, + new_is_mutable: Option, + nonce: u64, + index: u32, + ) -> Result<()> { + assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; - replace_leaf( - &merkle_tree.key(), - *ctx.bumps.get("tree_authority").unwrap(), + // Determine how the user opted to pass in the old MetadataArgs + let old_metadata = fetch_old_metadata_args(old_metadata, &ctx.accounts.old_metadata_acct)?; + + // NFTs updated through this instruction must be linked to a collection, + // and the collection authority for that collection must sign + let collection = old_metadata.collection.as_ref().unwrap(); + assert_collection_authority_signed_if_required( + &collection, + &ctx.accounts.collection_authority.to_account_info(), + &ctx.accounts.collection_authority_record_pda, + &ctx.accounts.collection_mint, + &ctx.accounts.collection_metadata.to_account_info(), + &ctx.accounts.collection_metadata, + &ctx.accounts.token_metadata_program)?; + + process_update_metadata( + &ctx.accounts.merkle_tree.to_account_info(), + &ctx.accounts.leaf_owner, + &ctx.accounts.leaf_delegate, &ctx.accounts.compression_program.to_account_info(), &ctx.accounts.tree_authority.to_account_info(), - &ctx.accounts.merkle_tree.to_account_info(), - &ctx.accounts.log_wrapper.to_account_info(), - ctx.remaining_accounts, + *ctx.bumps.get("tree_authority").unwrap(), + &ctx.accounts.log_wrapper, + &ctx.remaining_accounts, root, - previous_leaf.to_node(), - new_leaf.to_node(), - index, - ) + old_metadata, + new_name, + new_symbol, + new_uri, + new_creators, + new_seller_fee_basis_points, + new_primary_sale_happened, + new_is_mutable, + nonce, + index) } pub fn redeem<'info>( From c71ac65e19566d908cd0364ac102a6876fbcbc30 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 14:10:46 -0400 Subject: [PATCH 06/17] all tests included --- clients/js-solita/tests/main.test.ts | 130 ++------------------------- 1 file changed, 9 insertions(+), 121 deletions(-) diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index 1467e868..8d54447c 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -237,7 +237,6 @@ describe('Bubblegum tests', () => { await setupTreeWithCompressedNFT(connection, payerKeypair, compressedNFT, { maxDepth: 14, maxBufferSize: 64 }); }); - // TODO sorend: move to bottom of file describe('Unit test compressed NFT instructions', () => { const MAX_DEPTH = 14; let creators: Creator[] = [ @@ -266,6 +265,12 @@ describe('Bubblegum tests', () => { ); merkleTree = result.merkleTree; }); + + it('Can verify existence of a compressed NFT', async () => { + const updateSuccess = await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, originalCompressedNFT); + assert(updateSuccess.success === true, "Failed to verify leaf"); + }); + it('Non-collection NFT Update', async () => { const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); @@ -402,123 +407,8 @@ describe('Bubblegum tests', () => { // We should now be able to verify the new leaf with the metadata replaced await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); }); - }) - - describe.skip('Unit test compressed NFT collection instructions', () => { - const MAX_DEPTH = 14; - let merkleTree: PublicKey; - let originalCompressedNFT: MetadataArgs; - let collection: CreateCompressedNftOutput; - beforeEach(async () => { - await connection.requestAirdrop(payer, LAMPORTS_PER_SOL); - console.log(await connection.getBalance(payer)); - collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) - originalCompressedNFT = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); - const result = await setupTreeWithCompressedNFT( - connection, - payerKeypair, - originalCompressedNFT, - { - maxDepth: MAX_DEPTH, - maxBufferSize: 64, - } - ); - merkleTree = result.merkleTree; - }); - - // TODO sorend: remove this test - it('Can verify existence of a compressed NFT', async () => { - const updateSuccess = await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, originalCompressedNFT); - assert(updateSuccess.success === true, "Failed to verify leaf"); - }); - - it.skip('Collection NFT Update', async () => { - const collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) - const [bubblegumSigner] = PublicKey.findProgramAddressSync([Buffer.from("collection_cpi")], BUBBLEGUM_PROGRAM_ID); - const [treeAuthority] = PublicKey.findProgramAddressSync( - [merkleTree.toBuffer()], - BUBBLEGUM_PROGRAM_ID, - ); - const metadataArgs = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); - - // Mint a New NFT to a Collection - const mintToCollectionIx = createMintToCollectionV1Instruction({ - treeAuthority, - leafOwner: payer, - leafDelegate: payer, - merkleTree, - payer, - treeDelegate: payer, - collectionAuthority: payer, - collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, - collectionMint: collection.mintAddress, - collectionMetadata: collection.metadataAddress, - editionAccount: collection.masterEditionAddress, - bubblegumSigner, - logWrapper: SPL_NOOP_PROGRAM_ID, - compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, - }, { - metadataArgs - }) - - const mintToCollectionTxId = await sendAndConfirmTransaction(connection, new Transaction().add(mintToCollectionIx), [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); - - console.log("Mint to Collection Success:", mintToCollectionTxId) - - // Update the NFT in the collection - const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); - const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); - const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( - { - oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, - collectionAuthority: payer, - collectionMint: collection.mintAddress, - collectionMetadata: collection.metadataAddress, - collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, - treeAuthority, - treeDelegate: payer, - leafOwner: payer, - leafDelegate: payer, - payer, - merkleTree, - logWrapper: SPL_NOOP_PROGRAM_ID, - compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, - }, - { - root: Array.from(merkleAccount.getCurrentRoot()), - oldMetadata: metadataArgs, - newName: 'NewName', - newSymbol: 'NewSymbol', - newUri: 'https://foobar.com', - newCreators: null, - newSellerFeeBasisPoints: null, - newPrimarySaleHappened: null, - newIsMutable: null, - nonce: 0, - index: 1 - }, - ); - - const updateMetadataTx = new Transaction().add(updateMetadataIx); - const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); - - console.log("Update metadata tx success:", updateMetadataTxId) - - const newMetadataArgs: MetadataArgs = { ...metadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; - - // We should now be able to verify the new leaf with the metadata replaced - await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); - }); - it.skip('Can transfer and burn a compressed NFT', async () => { + it('Can transfer and burn a compressed NFT', async () => { // Transfer. const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); @@ -586,7 +476,7 @@ describe('Bubblegum tests', () => { console.log('NFT burn tx:', burnTxId); }); - it.skip('Can redeem and decompress compressed NFT', async () => { + it('Can redeem and decompress compressed NFT', async () => { // Redeem. const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); @@ -678,7 +568,5 @@ describe('Bubblegum tests', () => { console.log('NFT decompress tx:', decompressTxId); }); - - // TODO(@metaplex): add collection tests here - }); + }) }); From c8864dff99a31ecb497865dd083dce5e93d03a50 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 15:32:47 -0400 Subject: [PATCH 07/17] regen solita and fix bugs --- .../src/generated/accounts/TreeConfig.ts | 63 +- .../src/generated/accounts/Voucher.ts | 69 +- .../js-solita/src/generated/accounts/index.ts | 10 +- .../js-solita/src/generated/errors/index.ts | 643 ++++++++---------- clients/js-solita/src/generated/index.ts | 14 +- .../src/generated/instructions/burn.ts | 54 +- .../generated/instructions/cancelRedeem.ts | 48 +- .../src/generated/instructions/compress.ts | 60 +- .../src/generated/instructions/createTree.ts | 52 +- .../generated/instructions/decompressV1.ts | 64 +- .../src/generated/instructions/delegate.ts | 58 +- .../src/generated/instructions/index.ts | 4 +- .../instructions/mintToCollectionV1.ts | 68 +- .../src/generated/instructions/mintV1.ts | 54 +- .../src/generated/instructions/redeem.ts | 58 +- .../instructions/setAndVerifyCollection.ts | 80 +-- .../generated/instructions/setTreeDelegate.ts | 40 +- .../src/generated/instructions/transfer.ts | 58 +- .../instructions/unverifyCollection.ts | 78 ++- .../generated/instructions/unverifyCreator.ts | 64 +- .../generated/instructions/updateMetadata.ts | 80 ++- .../updateMetadataCollectionNft.ts | 89 ++- .../instructions/verifyCollection.ts | 78 ++- .../generated/instructions/verifyCreator.ts | 64 +- .../src/generated/types/BubblegumEventType.ts | 6 +- .../src/generated/types/Collection.ts | 16 +- .../js-solita/src/generated/types/Creator.ts | 18 +- .../src/generated/types/InstructionName.ts | 8 +- .../src/generated/types/LeafSchema.ts | 33 +- .../src/generated/types/MetadataArgs.ts | 45 +- .../generated/types/TokenProgramVersion.ts | 6 +- .../src/generated/types/TokenStandard.ts | 7 +- .../src/generated/types/UseMethod.ts | 7 +- clients/js-solita/src/generated/types/Uses.ts | 16 +- .../js-solita/src/generated/types/Version.ts | 7 +- idls/bubblegum.json | 30 +- programs/bubblegum/program/src/lib.rs | 2 +- 37 files changed, 992 insertions(+), 1159 deletions(-) diff --git a/clients/js-solita/src/generated/accounts/TreeConfig.ts b/clients/js-solita/src/generated/accounts/TreeConfig.ts index b693c157..b01c8c5d 100644 --- a/clients/js-solita/src/generated/accounts/TreeConfig.ts +++ b/clients/js-solita/src/generated/accounts/TreeConfig.ts @@ -24,7 +24,7 @@ export type TreeConfigArgs = { isDecompressable: DecompressableState; }; -export const treeConfigDiscriminator = [122, 245, 175, 248, 171, 34, 0, 207] +export const treeConfigDiscriminator = [122, 245, 175, 248, 171, 34, 0, 207]; /** * Holds the data for the {@link TreeConfig} Account and provides de/serialization * functionality for that data @@ -60,11 +60,8 @@ export class TreeConfig implements TreeConfigArgs { * Deserializes the {@link TreeConfig} from the data of the provided {@link web3.AccountInfo}. * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [TreeConfig, number] { - return TreeConfig.deserialize(accountInfo.data, offset) + static fromAccountInfo(accountInfo: web3.AccountInfo, offset = 0): [TreeConfig, number] { + return TreeConfig.deserialize(accountInfo.data, offset); } /** @@ -76,16 +73,13 @@ export class TreeConfig implements TreeConfigArgs { static async fromAccountAddress( connection: web3.Connection, address: web3.PublicKey, - commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig + commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, ): Promise { - const accountInfo = await connection.getAccountInfo( - address, - commitmentOrConfig - ) + const accountInfo = await connection.getAccountInfo(address, commitmentOrConfig); if (accountInfo == null) { - throw new Error(`Unable to find TreeConfig account at ${address}`) + throw new Error(`Unable to find TreeConfig account at ${address}`); } - return TreeConfig.fromAccountInfo(accountInfo, 0)[0] + return TreeConfig.fromAccountInfo(accountInfo, 0)[0]; } /** @@ -95,11 +89,9 @@ export class TreeConfig implements TreeConfigArgs { * @param programId - the program that owns the accounts we are filtering */ static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' - ) + programId: web3.PublicKey = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { - return beetSolana.GpaBuilder.fromStruct(programId, treeConfigBeet) + return beetSolana.GpaBuilder.fromStruct(programId, treeConfigBeet); } /** @@ -107,7 +99,7 @@ export class TreeConfig implements TreeConfigArgs { * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ static deserialize(buf: Buffer, offset = 0): [TreeConfig, number] { - return treeConfigBeet.deserialize(buf, offset) + return treeConfigBeet.deserialize(buf, offset); } /** @@ -118,7 +110,7 @@ export class TreeConfig implements TreeConfigArgs { return treeConfigBeet.serialize({ accountDiscriminator: treeConfigDiscriminator, ...this, - }) + }); } /** @@ -126,7 +118,7 @@ export class TreeConfig implements TreeConfigArgs { * {@link TreeConfig} */ static get byteSize() { - return treeConfigBeet.byteSize + return treeConfigBeet.byteSize; } /** @@ -137,12 +129,9 @@ export class TreeConfig implements TreeConfigArgs { */ static async getMinimumBalanceForRentExemption( connection: web3.Connection, - commitment?: web3.Commitment + commitment?: web3.Commitment, ): Promise { - return connection.getMinimumBalanceForRentExemption( - TreeConfig.byteSize, - commitment - ) + return connection.getMinimumBalanceForRentExemption(TreeConfig.byteSize, commitment); } /** @@ -150,7 +139,7 @@ export class TreeConfig implements TreeConfigArgs { * hold {@link TreeConfig} data. */ static hasCorrectByteSize(buf: Buffer, offset = 0) { - return buf.byteLength - offset === TreeConfig.byteSize + return buf.byteLength - offset === TreeConfig.byteSize; } /** @@ -162,26 +151,26 @@ export class TreeConfig implements TreeConfigArgs { treeCreator: this.treeCreator.toBase58(), treeDelegate: this.treeDelegate.toBase58(), totalMintCapacity: (() => { - const x = <{ toNumber: () => number }>this.totalMintCapacity + const x = <{ toNumber: () => number }>this.totalMintCapacity; if (typeof x.toNumber === 'function') { try { - return x.toNumber() + return x.toNumber(); } catch (_) { - return x + return x; } } - return x + return x; })(), numMinted: (() => { - const x = <{ toNumber: () => number }>this.numMinted + const x = <{ toNumber: () => number }>this.numMinted; if (typeof x.toNumber === 'function') { try { - return x.toNumber() + return x.toNumber(); } catch (_) { - return x + return x; } } - return x + return x; })(), isPublic: this.isPublic, isDecompressable: 'DecompressableState.' + DecompressableState[this.isDecompressable], @@ -196,7 +185,7 @@ export class TreeConfig implements TreeConfigArgs { export const treeConfigBeet = new beet.BeetStruct< TreeConfig, TreeConfigArgs & { - accountDiscriminator: number[] /* size: 8 */ + accountDiscriminator: number[] /* size: 8 */; } >( [ @@ -209,5 +198,5 @@ export const treeConfigBeet = new beet.BeetStruct< ['isDecompressable', decompressableStateBeet], ], TreeConfig.fromArgs, - 'TreeConfig' -) + 'TreeConfig', +); diff --git a/clients/js-solita/src/generated/accounts/Voucher.ts b/clients/js-solita/src/generated/accounts/Voucher.ts index 0f19f266..46c12205 100644 --- a/clients/js-solita/src/generated/accounts/Voucher.ts +++ b/clients/js-solita/src/generated/accounts/Voucher.ts @@ -5,10 +5,10 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema' +import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet'; +import * as beetSolana from '@metaplex-foundation/beet-solana'; +import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema'; /** * Arguments used to create {@link Voucher} @@ -16,12 +16,12 @@ import { LeafSchema, leafSchemaBeet } from '../types/LeafSchema' * @category generated */ export type VoucherArgs = { - leafSchema: LeafSchema - index: number - merkleTree: web3.PublicKey -} + leafSchema: LeafSchema; + index: number; + merkleTree: web3.PublicKey; +}; -export const voucherDiscriminator = [191, 204, 149, 234, 213, 165, 13, 65] +export const voucherDiscriminator = [191, 204, 149, 234, 213, 165, 13, 65]; /** * Holds the data for the {@link Voucher} Account and provides de/serialization * functionality for that data @@ -33,25 +33,22 @@ export class Voucher implements VoucherArgs { private constructor( readonly leafSchema: LeafSchema, readonly index: number, - readonly merkleTree: web3.PublicKey + readonly merkleTree: web3.PublicKey, ) {} /** * Creates a {@link Voucher} instance from the provided args. */ static fromArgs(args: VoucherArgs) { - return new Voucher(args.leafSchema, args.index, args.merkleTree) + return new Voucher(args.leafSchema, args.index, args.merkleTree); } /** * Deserializes the {@link Voucher} from the data of the provided {@link web3.AccountInfo}. * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [Voucher, number] { - return Voucher.deserialize(accountInfo.data, offset) + static fromAccountInfo(accountInfo: web3.AccountInfo, offset = 0): [Voucher, number] { + return Voucher.deserialize(accountInfo.data, offset); } /** @@ -63,16 +60,13 @@ export class Voucher implements VoucherArgs { static async fromAccountAddress( connection: web3.Connection, address: web3.PublicKey, - commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig + commitmentOrConfig?: web3.Commitment | web3.GetAccountInfoConfig, ): Promise { - const accountInfo = await connection.getAccountInfo( - address, - commitmentOrConfig - ) + const accountInfo = await connection.getAccountInfo(address, commitmentOrConfig); if (accountInfo == null) { - throw new Error(`Unable to find Voucher account at ${address}`) + throw new Error(`Unable to find Voucher account at ${address}`); } - return Voucher.fromAccountInfo(accountInfo, 0)[0] + return Voucher.fromAccountInfo(accountInfo, 0)[0]; } /** @@ -82,11 +76,9 @@ export class Voucher implements VoucherArgs { * @param programId - the program that owns the accounts we are filtering */ static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' - ) + programId: web3.PublicKey = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { - return beetSolana.GpaBuilder.fromStruct(programId, voucherBeet) + return beetSolana.GpaBuilder.fromStruct(programId, voucherBeet); } /** @@ -94,7 +86,7 @@ export class Voucher implements VoucherArgs { * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. */ static deserialize(buf: Buffer, offset = 0): [Voucher, number] { - return voucherBeet.deserialize(buf, offset) + return voucherBeet.deserialize(buf, offset); } /** @@ -105,7 +97,7 @@ export class Voucher implements VoucherArgs { return voucherBeet.serialize({ accountDiscriminator: voucherDiscriminator, ...this, - }) + }); } /** @@ -116,11 +108,11 @@ export class Voucher implements VoucherArgs { * depends on them */ static byteSize(args: VoucherArgs) { - const instance = Voucher.fromArgs(args) + const instance = Voucher.fromArgs(args); return voucherBeet.toFixedFromValue({ accountDiscriminator: voucherDiscriminator, ...instance, - }).byteSize + }).byteSize; } /** @@ -134,12 +126,9 @@ export class Voucher implements VoucherArgs { static async getMinimumBalanceForRentExemption( args: VoucherArgs, connection: web3.Connection, - commitment?: web3.Commitment + commitment?: web3.Commitment, ): Promise { - return connection.getMinimumBalanceForRentExemption( - Voucher.byteSize(args), - commitment - ) + return connection.getMinimumBalanceForRentExemption(Voucher.byteSize(args), commitment); } /** @@ -151,7 +140,7 @@ export class Voucher implements VoucherArgs { leafSchema: this.leafSchema.__kind, index: this.index, merkleTree: this.merkleTree.toBase58(), - } + }; } } @@ -162,7 +151,7 @@ export class Voucher implements VoucherArgs { export const voucherBeet = new beet.FixableBeetStruct< Voucher, VoucherArgs & { - accountDiscriminator: number[] /* size: 8 */ + accountDiscriminator: number[] /* size: 8 */; } >( [ @@ -172,5 +161,5 @@ export const voucherBeet = new beet.FixableBeetStruct< ['merkleTree', beetSolana.publicKey], ], Voucher.fromArgs, - 'Voucher' -) + 'Voucher', +); diff --git a/clients/js-solita/src/generated/accounts/index.ts b/clients/js-solita/src/generated/accounts/index.ts index ee04d8f1..d826f962 100644 --- a/clients/js-solita/src/generated/accounts/index.ts +++ b/clients/js-solita/src/generated/accounts/index.ts @@ -1,7 +1,7 @@ -export * from './TreeConfig' -export * from './Voucher' +export * from './TreeConfig'; +export * from './Voucher'; -import { TreeConfig } from './TreeConfig' -import { Voucher } from './Voucher' +import { TreeConfig } from './TreeConfig'; +import { Voucher } from './Voucher'; -export const accountProviders = { TreeConfig, Voucher } +export const accountProviders = { TreeConfig, Voucher }; diff --git a/clients/js-solita/src/generated/errors/index.ts b/clients/js-solita/src/generated/errors/index.ts index 918df6f2..1aadc4ff 100644 --- a/clients/js-solita/src/generated/errors/index.ts +++ b/clients/js-solita/src/generated/errors/index.ts @@ -5,11 +5,11 @@ * See: https://github.com/metaplex-foundation/solita */ -type ErrorWithCode = Error & { code: number } -type MaybeErrorWithCode = ErrorWithCode | null | undefined +type ErrorWithCode = Error & { code: number }; +type MaybeErrorWithCode = ErrorWithCode | null | undefined; -const createErrorFromCodeLookup: Map ErrorWithCode> = new Map() -const createErrorFromNameLookup: Map ErrorWithCode> = new Map() +const createErrorFromCodeLookup: Map ErrorWithCode> = new Map(); +const createErrorFromNameLookup: Map ErrorWithCode> = new Map(); /** * AssetOwnerMismatch: 'Asset Owner Does not match' @@ -18,21 +18,18 @@ const createErrorFromNameLookup: Map ErrorWithCode> = new Map() * @category generated */ export class AssetOwnerMismatchError extends Error { - readonly code: number = 0x1770 - readonly name: string = 'AssetOwnerMismatch' + readonly code: number = 0x1770; + readonly name: string = 'AssetOwnerMismatch'; constructor() { - super('Asset Owner Does not match') + super('Asset Owner Does not match'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, AssetOwnerMismatchError) + Error.captureStackTrace(this, AssetOwnerMismatchError); } } } -createErrorFromCodeLookup.set(0x1770, () => new AssetOwnerMismatchError()) -createErrorFromNameLookup.set( - 'AssetOwnerMismatch', - () => new AssetOwnerMismatchError() -) +createErrorFromCodeLookup.set(0x1770, () => new AssetOwnerMismatchError()); +createErrorFromNameLookup.set('AssetOwnerMismatch', () => new AssetOwnerMismatchError()); /** * PublicKeyMismatch: 'PublicKeyMismatch' @@ -41,21 +38,18 @@ createErrorFromNameLookup.set( * @category generated */ export class PublicKeyMismatchError extends Error { - readonly code: number = 0x1771 - readonly name: string = 'PublicKeyMismatch' + readonly code: number = 0x1771; + readonly name: string = 'PublicKeyMismatch'; constructor() { - super('PublicKeyMismatch') + super('PublicKeyMismatch'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, PublicKeyMismatchError) + Error.captureStackTrace(this, PublicKeyMismatchError); } } } -createErrorFromCodeLookup.set(0x1771, () => new PublicKeyMismatchError()) -createErrorFromNameLookup.set( - 'PublicKeyMismatch', - () => new PublicKeyMismatchError() -) +createErrorFromCodeLookup.set(0x1771, () => new PublicKeyMismatchError()); +createErrorFromNameLookup.set('PublicKeyMismatch', () => new PublicKeyMismatchError()); /** * HashingMismatch: 'Hashing Mismatch Within Leaf Schema' @@ -64,21 +58,18 @@ createErrorFromNameLookup.set( * @category generated */ export class HashingMismatchError extends Error { - readonly code: number = 0x1772 - readonly name: string = 'HashingMismatch' + readonly code: number = 0x1772; + readonly name: string = 'HashingMismatch'; constructor() { - super('Hashing Mismatch Within Leaf Schema') + super('Hashing Mismatch Within Leaf Schema'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, HashingMismatchError) + Error.captureStackTrace(this, HashingMismatchError); } } } -createErrorFromCodeLookup.set(0x1772, () => new HashingMismatchError()) -createErrorFromNameLookup.set( - 'HashingMismatch', - () => new HashingMismatchError() -) +createErrorFromCodeLookup.set(0x1772, () => new HashingMismatchError()); +createErrorFromNameLookup.set('HashingMismatch', () => new HashingMismatchError()); /** * UnsupportedSchemaVersion: 'Unsupported Schema Version' @@ -87,21 +78,21 @@ createErrorFromNameLookup.set( * @category generated */ export class UnsupportedSchemaVersionError extends Error { - readonly code: number = 0x1773 - readonly name: string = 'UnsupportedSchemaVersion' + readonly code: number = 0x1773; + readonly name: string = 'UnsupportedSchemaVersion'; constructor() { - super('Unsupported Schema Version') + super('Unsupported Schema Version'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, UnsupportedSchemaVersionError) + Error.captureStackTrace(this, UnsupportedSchemaVersionError); } } } -createErrorFromCodeLookup.set(0x1773, () => new UnsupportedSchemaVersionError()) +createErrorFromCodeLookup.set(0x1773, () => new UnsupportedSchemaVersionError()); createErrorFromNameLookup.set( 'UnsupportedSchemaVersion', - () => new UnsupportedSchemaVersionError() -) + () => new UnsupportedSchemaVersionError(), +); /** * CreatorShareTotalMustBe100: 'Creator shares must sum to 100' @@ -110,24 +101,21 @@ createErrorFromNameLookup.set( * @category generated */ export class CreatorShareTotalMustBe100Error extends Error { - readonly code: number = 0x1774 - readonly name: string = 'CreatorShareTotalMustBe100' + readonly code: number = 0x1774; + readonly name: string = 'CreatorShareTotalMustBe100'; constructor() { - super('Creator shares must sum to 100') + super('Creator shares must sum to 100'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorShareTotalMustBe100Error) + Error.captureStackTrace(this, CreatorShareTotalMustBe100Error); } } } -createErrorFromCodeLookup.set( - 0x1774, - () => new CreatorShareTotalMustBe100Error() -) +createErrorFromCodeLookup.set(0x1774, () => new CreatorShareTotalMustBe100Error()); createErrorFromNameLookup.set( 'CreatorShareTotalMustBe100', - () => new CreatorShareTotalMustBe100Error() -) + () => new CreatorShareTotalMustBe100Error(), +); /** * DuplicateCreatorAddress: 'No duplicate creator addresses in metadata' @@ -136,21 +124,18 @@ createErrorFromNameLookup.set( * @category generated */ export class DuplicateCreatorAddressError extends Error { - readonly code: number = 0x1775 - readonly name: string = 'DuplicateCreatorAddress' + readonly code: number = 0x1775; + readonly name: string = 'DuplicateCreatorAddress'; constructor() { - super('No duplicate creator addresses in metadata') + super('No duplicate creator addresses in metadata'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, DuplicateCreatorAddressError) + Error.captureStackTrace(this, DuplicateCreatorAddressError); } } } -createErrorFromCodeLookup.set(0x1775, () => new DuplicateCreatorAddressError()) -createErrorFromNameLookup.set( - 'DuplicateCreatorAddress', - () => new DuplicateCreatorAddressError() -) +createErrorFromCodeLookup.set(0x1775, () => new DuplicateCreatorAddressError()); +createErrorFromNameLookup.set('DuplicateCreatorAddress', () => new DuplicateCreatorAddressError()); /** * CreatorDidNotVerify: 'Creator did not verify the metadata' @@ -159,21 +144,18 @@ createErrorFromNameLookup.set( * @category generated */ export class CreatorDidNotVerifyError extends Error { - readonly code: number = 0x1776 - readonly name: string = 'CreatorDidNotVerify' + readonly code: number = 0x1776; + readonly name: string = 'CreatorDidNotVerify'; constructor() { - super('Creator did not verify the metadata') + super('Creator did not verify the metadata'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorDidNotVerifyError) + Error.captureStackTrace(this, CreatorDidNotVerifyError); } } } -createErrorFromCodeLookup.set(0x1776, () => new CreatorDidNotVerifyError()) -createErrorFromNameLookup.set( - 'CreatorDidNotVerify', - () => new CreatorDidNotVerifyError() -) +createErrorFromCodeLookup.set(0x1776, () => new CreatorDidNotVerifyError()); +createErrorFromNameLookup.set('CreatorDidNotVerify', () => new CreatorDidNotVerifyError()); /** * CreatorNotFound: 'Creator not found in creator Vec' @@ -182,21 +164,18 @@ createErrorFromNameLookup.set( * @category generated */ export class CreatorNotFoundError extends Error { - readonly code: number = 0x1777 - readonly name: string = 'CreatorNotFound' + readonly code: number = 0x1777; + readonly name: string = 'CreatorNotFound'; constructor() { - super('Creator not found in creator Vec') + super('Creator not found in creator Vec'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorNotFoundError) + Error.captureStackTrace(this, CreatorNotFoundError); } } } -createErrorFromCodeLookup.set(0x1777, () => new CreatorNotFoundError()) -createErrorFromNameLookup.set( - 'CreatorNotFound', - () => new CreatorNotFoundError() -) +createErrorFromCodeLookup.set(0x1777, () => new CreatorNotFoundError()); +createErrorFromNameLookup.set('CreatorNotFound', () => new CreatorNotFoundError()); /** * NoCreatorsPresent: 'No creators in creator Vec' @@ -205,21 +184,18 @@ createErrorFromNameLookup.set( * @category generated */ export class NoCreatorsPresentError extends Error { - readonly code: number = 0x1778 - readonly name: string = 'NoCreatorsPresent' + readonly code: number = 0x1778; + readonly name: string = 'NoCreatorsPresent'; constructor() { - super('No creators in creator Vec') + super('No creators in creator Vec'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, NoCreatorsPresentError) + Error.captureStackTrace(this, NoCreatorsPresentError); } } } -createErrorFromCodeLookup.set(0x1778, () => new NoCreatorsPresentError()) -createErrorFromNameLookup.set( - 'NoCreatorsPresent', - () => new NoCreatorsPresentError() -) +createErrorFromCodeLookup.set(0x1778, () => new NoCreatorsPresentError()); +createErrorFromNameLookup.set('NoCreatorsPresent', () => new NoCreatorsPresentError()); /** * CreatorHashMismatch: 'User-provided creator Vec must result in same user-provided creator hash' @@ -228,23 +204,18 @@ createErrorFromNameLookup.set( * @category generated */ export class CreatorHashMismatchError extends Error { - readonly code: number = 0x1779 - readonly name: string = 'CreatorHashMismatch' + readonly code: number = 0x1779; + readonly name: string = 'CreatorHashMismatch'; constructor() { - super( - 'User-provided creator Vec must result in same user-provided creator hash' - ) + super('User-provided creator Vec must result in same user-provided creator hash'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorHashMismatchError) + Error.captureStackTrace(this, CreatorHashMismatchError); } } } -createErrorFromCodeLookup.set(0x1779, () => new CreatorHashMismatchError()) -createErrorFromNameLookup.set( - 'CreatorHashMismatch', - () => new CreatorHashMismatchError() -) +createErrorFromCodeLookup.set(0x1779, () => new CreatorHashMismatchError()); +createErrorFromNameLookup.set('CreatorHashMismatch', () => new CreatorHashMismatchError()); /** * DataHashMismatch: 'User-provided metadata must result in same user-provided data hash' @@ -253,21 +224,18 @@ createErrorFromNameLookup.set( * @category generated */ export class DataHashMismatchError extends Error { - readonly code: number = 0x177a - readonly name: string = 'DataHashMismatch' + readonly code: number = 0x177a; + readonly name: string = 'DataHashMismatch'; constructor() { - super('User-provided metadata must result in same user-provided data hash') + super('User-provided metadata must result in same user-provided data hash'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, DataHashMismatchError) + Error.captureStackTrace(this, DataHashMismatchError); } } } -createErrorFromCodeLookup.set(0x177a, () => new DataHashMismatchError()) -createErrorFromNameLookup.set( - 'DataHashMismatch', - () => new DataHashMismatchError() -) +createErrorFromCodeLookup.set(0x177a, () => new DataHashMismatchError()); +createErrorFromNameLookup.set('DataHashMismatch', () => new DataHashMismatchError()); /** * CreatorsTooLong: 'Creators list too long' @@ -276,21 +244,18 @@ createErrorFromNameLookup.set( * @category generated */ export class CreatorsTooLongError extends Error { - readonly code: number = 0x177b - readonly name: string = 'CreatorsTooLong' + readonly code: number = 0x177b; + readonly name: string = 'CreatorsTooLong'; constructor() { - super('Creators list too long') + super('Creators list too long'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CreatorsTooLongError) + Error.captureStackTrace(this, CreatorsTooLongError); } } } -createErrorFromCodeLookup.set(0x177b, () => new CreatorsTooLongError()) -createErrorFromNameLookup.set( - 'CreatorsTooLong', - () => new CreatorsTooLongError() -) +createErrorFromCodeLookup.set(0x177b, () => new CreatorsTooLongError()); +createErrorFromNameLookup.set('CreatorsTooLong', () => new CreatorsTooLongError()); /** * MetadataNameTooLong: 'Name in metadata is too long' @@ -299,21 +264,18 @@ createErrorFromNameLookup.set( * @category generated */ export class MetadataNameTooLongError extends Error { - readonly code: number = 0x177c - readonly name: string = 'MetadataNameTooLong' + readonly code: number = 0x177c; + readonly name: string = 'MetadataNameTooLong'; constructor() { - super('Name in metadata is too long') + super('Name in metadata is too long'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataNameTooLongError) + Error.captureStackTrace(this, MetadataNameTooLongError); } } } -createErrorFromCodeLookup.set(0x177c, () => new MetadataNameTooLongError()) -createErrorFromNameLookup.set( - 'MetadataNameTooLong', - () => new MetadataNameTooLongError() -) +createErrorFromCodeLookup.set(0x177c, () => new MetadataNameTooLongError()); +createErrorFromNameLookup.set('MetadataNameTooLong', () => new MetadataNameTooLongError()); /** * MetadataSymbolTooLong: 'Symbol in metadata is too long' @@ -322,21 +284,18 @@ createErrorFromNameLookup.set( * @category generated */ export class MetadataSymbolTooLongError extends Error { - readonly code: number = 0x177d - readonly name: string = 'MetadataSymbolTooLong' + readonly code: number = 0x177d; + readonly name: string = 'MetadataSymbolTooLong'; constructor() { - super('Symbol in metadata is too long') + super('Symbol in metadata is too long'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataSymbolTooLongError) + Error.captureStackTrace(this, MetadataSymbolTooLongError); } } } -createErrorFromCodeLookup.set(0x177d, () => new MetadataSymbolTooLongError()) -createErrorFromNameLookup.set( - 'MetadataSymbolTooLong', - () => new MetadataSymbolTooLongError() -) +createErrorFromCodeLookup.set(0x177d, () => new MetadataSymbolTooLongError()); +createErrorFromNameLookup.set('MetadataSymbolTooLong', () => new MetadataSymbolTooLongError()); /** * MetadataUriTooLong: 'Uri in metadata is too long' @@ -345,21 +304,18 @@ createErrorFromNameLookup.set( * @category generated */ export class MetadataUriTooLongError extends Error { - readonly code: number = 0x177e - readonly name: string = 'MetadataUriTooLong' + readonly code: number = 0x177e; + readonly name: string = 'MetadataUriTooLong'; constructor() { - super('Uri in metadata is too long') + super('Uri in metadata is too long'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataUriTooLongError) + Error.captureStackTrace(this, MetadataUriTooLongError); } } } -createErrorFromCodeLookup.set(0x177e, () => new MetadataUriTooLongError()) -createErrorFromNameLookup.set( - 'MetadataUriTooLong', - () => new MetadataUriTooLongError() -) +createErrorFromCodeLookup.set(0x177e, () => new MetadataUriTooLongError()); +createErrorFromNameLookup.set('MetadataUriTooLong', () => new MetadataUriTooLongError()); /** * MetadataBasisPointsTooHigh: 'Basis points in metadata cannot exceed 10000' @@ -368,24 +324,21 @@ createErrorFromNameLookup.set( * @category generated */ export class MetadataBasisPointsTooHighError extends Error { - readonly code: number = 0x177f - readonly name: string = 'MetadataBasisPointsTooHigh' + readonly code: number = 0x177f; + readonly name: string = 'MetadataBasisPointsTooHigh'; constructor() { - super('Basis points in metadata cannot exceed 10000') + super('Basis points in metadata cannot exceed 10000'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataBasisPointsTooHighError) + Error.captureStackTrace(this, MetadataBasisPointsTooHighError); } } } -createErrorFromCodeLookup.set( - 0x177f, - () => new MetadataBasisPointsTooHighError() -) +createErrorFromCodeLookup.set(0x177f, () => new MetadataBasisPointsTooHighError()); createErrorFromNameLookup.set( 'MetadataBasisPointsTooHigh', - () => new MetadataBasisPointsTooHighError() -) + () => new MetadataBasisPointsTooHighError(), +); /** * TreeAuthorityIncorrect: 'Tree creator or tree delegate must sign.' @@ -394,21 +347,18 @@ createErrorFromNameLookup.set( * @category generated */ export class TreeAuthorityIncorrectError extends Error { - readonly code: number = 0x1780 - readonly name: string = 'TreeAuthorityIncorrect' + readonly code: number = 0x1780; + readonly name: string = 'TreeAuthorityIncorrect'; constructor() { - super('Tree creator or tree delegate must sign.') + super('Tree creator or tree delegate must sign.'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, TreeAuthorityIncorrectError) + Error.captureStackTrace(this, TreeAuthorityIncorrectError); } } } -createErrorFromCodeLookup.set(0x1780, () => new TreeAuthorityIncorrectError()) -createErrorFromNameLookup.set( - 'TreeAuthorityIncorrect', - () => new TreeAuthorityIncorrectError() -) +createErrorFromCodeLookup.set(0x1780, () => new TreeAuthorityIncorrectError()); +createErrorFromNameLookup.set('TreeAuthorityIncorrect', () => new TreeAuthorityIncorrectError()); /** * InsufficientMintCapacity: 'Not enough unapproved mints left' @@ -417,21 +367,21 @@ createErrorFromNameLookup.set( * @category generated */ export class InsufficientMintCapacityError extends Error { - readonly code: number = 0x1781 - readonly name: string = 'InsufficientMintCapacity' + readonly code: number = 0x1781; + readonly name: string = 'InsufficientMintCapacity'; constructor() { - super('Not enough unapproved mints left') + super('Not enough unapproved mints left'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InsufficientMintCapacityError) + Error.captureStackTrace(this, InsufficientMintCapacityError); } } } -createErrorFromCodeLookup.set(0x1781, () => new InsufficientMintCapacityError()) +createErrorFromCodeLookup.set(0x1781, () => new InsufficientMintCapacityError()); createErrorFromNameLookup.set( 'InsufficientMintCapacity', - () => new InsufficientMintCapacityError() -) + () => new InsufficientMintCapacityError(), +); /** * NumericalOverflowError: 'NumericalOverflowError' @@ -440,21 +390,18 @@ createErrorFromNameLookup.set( * @category generated */ export class NumericalOverflowErrorError extends Error { - readonly code: number = 0x1782 - readonly name: string = 'NumericalOverflowError' + readonly code: number = 0x1782; + readonly name: string = 'NumericalOverflowError'; constructor() { - super('NumericalOverflowError') + super('NumericalOverflowError'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, NumericalOverflowErrorError) + Error.captureStackTrace(this, NumericalOverflowErrorError); } } } -createErrorFromCodeLookup.set(0x1782, () => new NumericalOverflowErrorError()) -createErrorFromNameLookup.set( - 'NumericalOverflowError', - () => new NumericalOverflowErrorError() -) +createErrorFromCodeLookup.set(0x1782, () => new NumericalOverflowErrorError()); +createErrorFromNameLookup.set('NumericalOverflowError', () => new NumericalOverflowErrorError()); /** * IncorrectOwner: 'Incorrect account owner' @@ -463,18 +410,18 @@ createErrorFromNameLookup.set( * @category generated */ export class IncorrectOwnerError extends Error { - readonly code: number = 0x1783 - readonly name: string = 'IncorrectOwner' + readonly code: number = 0x1783; + readonly name: string = 'IncorrectOwner'; constructor() { - super('Incorrect account owner') + super('Incorrect account owner'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, IncorrectOwnerError) + Error.captureStackTrace(this, IncorrectOwnerError); } } } -createErrorFromCodeLookup.set(0x1783, () => new IncorrectOwnerError()) -createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError()) +createErrorFromCodeLookup.set(0x1783, () => new IncorrectOwnerError()); +createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError()); /** * CollectionCannotBeVerifiedInThisInstruction: 'Cannot Verify Collection in this Instruction' @@ -483,27 +430,21 @@ createErrorFromNameLookup.set('IncorrectOwner', () => new IncorrectOwnerError()) * @category generated */ export class CollectionCannotBeVerifiedInThisInstructionError extends Error { - readonly code: number = 0x1784 - readonly name: string = 'CollectionCannotBeVerifiedInThisInstruction' + readonly code: number = 0x1784; + readonly name: string = 'CollectionCannotBeVerifiedInThisInstruction'; constructor() { - super('Cannot Verify Collection in this Instruction') + super('Cannot Verify Collection in this Instruction'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace( - this, - CollectionCannotBeVerifiedInThisInstructionError - ) + Error.captureStackTrace(this, CollectionCannotBeVerifiedInThisInstructionError); } } } -createErrorFromCodeLookup.set( - 0x1784, - () => new CollectionCannotBeVerifiedInThisInstructionError() -) +createErrorFromCodeLookup.set(0x1784, () => new CollectionCannotBeVerifiedInThisInstructionError()); createErrorFromNameLookup.set( 'CollectionCannotBeVerifiedInThisInstruction', - () => new CollectionCannotBeVerifiedInThisInstructionError() -) + () => new CollectionCannotBeVerifiedInThisInstructionError(), +); /** * CollectionNotFound: 'Collection Not Found on Metadata' @@ -512,21 +453,18 @@ createErrorFromNameLookup.set( * @category generated */ export class CollectionNotFoundError extends Error { - readonly code: number = 0x1785 - readonly name: string = 'CollectionNotFound' + readonly code: number = 0x1785; + readonly name: string = 'CollectionNotFound'; constructor() { - super('Collection Not Found on Metadata') + super('Collection Not Found on Metadata'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CollectionNotFoundError) + Error.captureStackTrace(this, CollectionNotFoundError); } } } -createErrorFromCodeLookup.set(0x1785, () => new CollectionNotFoundError()) -createErrorFromNameLookup.set( - 'CollectionNotFound', - () => new CollectionNotFoundError() -) +createErrorFromCodeLookup.set(0x1785, () => new CollectionNotFoundError()); +createErrorFromNameLookup.set('CollectionNotFound', () => new CollectionNotFoundError()); /** * AlreadyVerified: 'Collection item is already verified.' @@ -535,21 +473,18 @@ createErrorFromNameLookup.set( * @category generated */ export class AlreadyVerifiedError extends Error { - readonly code: number = 0x1786 - readonly name: string = 'AlreadyVerified' + readonly code: number = 0x1786; + readonly name: string = 'AlreadyVerified'; constructor() { - super('Collection item is already verified.') + super('Collection item is already verified.'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, AlreadyVerifiedError) + Error.captureStackTrace(this, AlreadyVerifiedError); } } } -createErrorFromCodeLookup.set(0x1786, () => new AlreadyVerifiedError()) -createErrorFromNameLookup.set( - 'AlreadyVerified', - () => new AlreadyVerifiedError() -) +createErrorFromCodeLookup.set(0x1786, () => new AlreadyVerifiedError()); +createErrorFromNameLookup.set('AlreadyVerified', () => new AlreadyVerifiedError()); /** * AlreadyUnverified: 'Collection item is already unverified.' @@ -558,21 +493,18 @@ createErrorFromNameLookup.set( * @category generated */ export class AlreadyUnverifiedError extends Error { - readonly code: number = 0x1787 - readonly name: string = 'AlreadyUnverified' + readonly code: number = 0x1787; + readonly name: string = 'AlreadyUnverified'; constructor() { - super('Collection item is already unverified.') + super('Collection item is already unverified.'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, AlreadyUnverifiedError) + Error.captureStackTrace(this, AlreadyUnverifiedError); } } } -createErrorFromCodeLookup.set(0x1787, () => new AlreadyUnverifiedError()) -createErrorFromNameLookup.set( - 'AlreadyUnverified', - () => new AlreadyUnverifiedError() -) +createErrorFromCodeLookup.set(0x1787, () => new AlreadyUnverifiedError()); +createErrorFromNameLookup.set('AlreadyUnverified', () => new AlreadyUnverifiedError()); /** * UpdateAuthorityIncorrect: 'Incorrect leaf metadata update authority.' @@ -581,21 +513,21 @@ createErrorFromNameLookup.set( * @category generated */ export class UpdateAuthorityIncorrectError extends Error { - readonly code: number = 0x1788 - readonly name: string = 'UpdateAuthorityIncorrect' + readonly code: number = 0x1788; + readonly name: string = 'UpdateAuthorityIncorrect'; constructor() { - super('Incorrect leaf metadata update authority.') + super('Incorrect leaf metadata update authority.'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, UpdateAuthorityIncorrectError) + Error.captureStackTrace(this, UpdateAuthorityIncorrectError); } } } -createErrorFromCodeLookup.set(0x1788, () => new UpdateAuthorityIncorrectError()) +createErrorFromCodeLookup.set(0x1788, () => new UpdateAuthorityIncorrectError()); createErrorFromNameLookup.set( 'UpdateAuthorityIncorrect', - () => new UpdateAuthorityIncorrectError() -) + () => new UpdateAuthorityIncorrectError(), +); /** * LeafAuthorityMustSign: 'This transaction must be signed by either the leaf owner or leaf delegate' @@ -604,23 +536,18 @@ createErrorFromNameLookup.set( * @category generated */ export class LeafAuthorityMustSignError extends Error { - readonly code: number = 0x1789 - readonly name: string = 'LeafAuthorityMustSign' + readonly code: number = 0x1789; + readonly name: string = 'LeafAuthorityMustSign'; constructor() { - super( - 'This transaction must be signed by either the leaf owner or leaf delegate' - ) + super('This transaction must be signed by either the leaf owner or leaf delegate'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, LeafAuthorityMustSignError) + Error.captureStackTrace(this, LeafAuthorityMustSignError); } } } -createErrorFromCodeLookup.set(0x1789, () => new LeafAuthorityMustSignError()) -createErrorFromNameLookup.set( - 'LeafAuthorityMustSign', - () => new LeafAuthorityMustSignError() -) +createErrorFromCodeLookup.set(0x1789, () => new LeafAuthorityMustSignError()); +createErrorFromNameLookup.set('LeafAuthorityMustSign', () => new LeafAuthorityMustSignError()); /** * CollectionMustBeSized: 'Collection Not Compatable with Compression, Must be Sized' @@ -629,136 +556,18 @@ createErrorFromNameLookup.set( * @category generated */ export class CollectionMustBeSizedError extends Error { - readonly code: number = 0x178a - readonly name: string = 'CollectionMustBeSized' - constructor() { - super('Collection Not Compatable with Compression, Must be Sized') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CollectionMustBeSizedError) - } - } -} - -createErrorFromCodeLookup.set(0x178a, () => new CollectionMustBeSizedError()) -createErrorFromNameLookup.set( - 'CollectionMustBeSized', - () => new CollectionMustBeSizedError() -) - -/** - * MetadataImmutable: 'Metadata Not Mutable' - * - * @category Errors - * @category generated - */ -export class MetadataImmutableError extends Error { - readonly code: number = 0x178b - readonly name: string = 'MetadataImmutable' - constructor() { - super('Metadata Not Mutable') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataImmutableError) - } - } -} - -createErrorFromCodeLookup.set(0x178b, () => new MetadataImmutableError()) -createErrorFromNameLookup.set( - 'MetadataImmutable', - () => new MetadataImmutableError() -) - -/** - * CollectionMismatch: 'Collection mismatch' - * - * @category Errors - * @category generated - */ -export class CollectionMismatchError extends Error { - readonly code: number = 0x178c - readonly name: string = 'CollectionMismatch' + readonly code: number = 0x178a; + readonly name: string = 'CollectionMustBeSized'; constructor() { - super('Collection mismatch') + super('Collection Not Compatable with Compression, Must be Sized'); if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CollectionMismatchError) + Error.captureStackTrace(this, CollectionMustBeSizedError); } } } -createErrorFromCodeLookup.set(0x178c, () => new CollectionMismatchError()) -createErrorFromNameLookup.set( - 'CollectionMismatch', - () => new CollectionMismatchError() -) - -/** - * MetadataArgsAmbiguous: 'MetadataArgs Ambiguous' - * - * @category Errors - * @category generated - */ -export class MetadataArgsAmbiguousError extends Error { - readonly code: number = 0x178d - readonly name: string = 'MetadataArgsAmbiguous' - constructor() { - super('MetadataArgs Ambiguous') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataArgsAmbiguousError) - } - } -} - -createErrorFromCodeLookup.set(0x178d, () => new MetadataArgsAmbiguousError()) -createErrorFromNameLookup.set( - 'MetadataArgsAmbiguous', - () => new MetadataArgsAmbiguousError() -) - -/** - * MetadataArgsMissing: 'MetadataArgs Missing' - * - * @category Errors - * @category generated - */ -export class MetadataArgsMissingError extends Error { - readonly code: number = 0x178e - readonly name: string = 'MetadataArgsMissing' - constructor() { - super('MetadataArgs Missing') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MetadataArgsMissingError) - } - } -} - -createErrorFromCodeLookup.set(0x178e, () => new MetadataArgsMissingError()) -createErrorFromNameLookup.set( - 'MetadataArgsMissing', - () => new MetadataArgsMissingError() -) - -/** - * NFTLinkedToCollection: 'NFT linked to collection' - * - * @category Errors - * @category generated - */ -export class NFTLinkedToCollectionError extends Error { - readonly code: number = 0x178f - readonly name: string = 'NFTLinkedToCollection' - constructor() { - super('NFT linked to collection') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, NFTLinkedToCollectionError) - } - } -} - -createErrorFromCodeLookup.set(0x178f, () => new NFTLinkedToCollectionError()) -createErrorFromNameLookup.set( - 'NFTLinkedToCollection', - () => new NFTLinkedToCollectionError() -) +createErrorFromCodeLookup.set(0x178a, () => new CollectionMustBeSizedError()); +createErrorFromNameLookup.set('CollectionMustBeSized', () => new CollectionMustBeSizedError()); /** * MetadataMintMismatch: 'Metadata mint does not match collection mint' @@ -909,14 +718,114 @@ export class DecompressionDisabledError extends Error { createErrorFromCodeLookup.set(0x1791, () => new DecompressionDisabledError()); createErrorFromNameLookup.set('DecompressionDisabled', () => new DecompressionDisabledError()); +/** + * MetadataImmutable: 'Metadata Not Mutable' + * + * @category Errors + * @category generated + */ +export class MetadataImmutableError extends Error { + readonly code: number = 0x1792; + readonly name: string = 'MetadataImmutable'; + constructor() { + super('Metadata Not Mutable'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, MetadataImmutableError); + } + } +} + +createErrorFromCodeLookup.set(0x1792, () => new MetadataImmutableError()); +createErrorFromNameLookup.set('MetadataImmutable', () => new MetadataImmutableError()); + +/** + * CollectionMismatch: 'Collection mismatch' + * + * @category Errors + * @category generated + */ +export class CollectionMismatchError extends Error { + readonly code: number = 0x1793; + readonly name: string = 'CollectionMismatch'; + constructor() { + super('Collection mismatch'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, CollectionMismatchError); + } + } +} + +createErrorFromCodeLookup.set(0x1793, () => new CollectionMismatchError()); +createErrorFromNameLookup.set('CollectionMismatch', () => new CollectionMismatchError()); + +/** + * MetadataArgsAmbiguous: 'MetadataArgs Ambiguous' + * + * @category Errors + * @category generated + */ +export class MetadataArgsAmbiguousError extends Error { + readonly code: number = 0x1794; + readonly name: string = 'MetadataArgsAmbiguous'; + constructor() { + super('MetadataArgs Ambiguous'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, MetadataArgsAmbiguousError); + } + } +} + +createErrorFromCodeLookup.set(0x1794, () => new MetadataArgsAmbiguousError()); +createErrorFromNameLookup.set('MetadataArgsAmbiguous', () => new MetadataArgsAmbiguousError()); + +/** + * MetadataArgsMissing: 'MetadataArgs Missing' + * + * @category Errors + * @category generated + */ +export class MetadataArgsMissingError extends Error { + readonly code: number = 0x1795; + readonly name: string = 'MetadataArgsMissing'; + constructor() { + super('MetadataArgs Missing'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, MetadataArgsMissingError); + } + } +} + +createErrorFromCodeLookup.set(0x1795, () => new MetadataArgsMissingError()); +createErrorFromNameLookup.set('MetadataArgsMissing', () => new MetadataArgsMissingError()); + +/** + * NFTLinkedToCollection: 'NFT linked to collection' + * + * @category Errors + * @category generated + */ +export class NFTLinkedToCollectionError extends Error { + readonly code: number = 0x1796; + readonly name: string = 'NFTLinkedToCollection'; + constructor() { + super('NFT linked to collection'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, NFTLinkedToCollectionError); + } + } +} + +createErrorFromCodeLookup.set(0x1796, () => new NFTLinkedToCollectionError()); +createErrorFromNameLookup.set('NFTLinkedToCollection', () => new NFTLinkedToCollectionError()); + /** * Attempts to resolve a custom program error from the provided error code. * @category Errors * @category generated */ export function errorFromCode(code: number): MaybeErrorWithCode { - const createError = createErrorFromCodeLookup.get(code) - return createError != null ? createError() : null + const createError = createErrorFromCodeLookup.get(code); + return createError != null ? createError() : null; } /** @@ -925,6 +834,6 @@ export function errorFromCode(code: number): MaybeErrorWithCode { * @category generated */ export function errorFromName(name: string): MaybeErrorWithCode { - const createError = createErrorFromNameLookup.get(name) - return createError != null ? createError() : null + const createError = createErrorFromNameLookup.get(name); + return createError != null ? createError() : null; } diff --git a/clients/js-solita/src/generated/index.ts b/clients/js-solita/src/generated/index.ts index d153d4d5..b8817cae 100644 --- a/clients/js-solita/src/generated/index.ts +++ b/clients/js-solita/src/generated/index.ts @@ -1,8 +1,8 @@ -import { PublicKey } from '@solana/web3.js' -export * from './accounts' -export * from './errors' -export * from './instructions' -export * from './types' +import { PublicKey } from '@solana/web3.js'; +export * from './accounts'; +export * from './errors'; +export * from './instructions'; +export * from './types'; /** * Program address @@ -10,7 +10,7 @@ export * from './types' * @category constants * @category generated */ -export const PROGRAM_ADDRESS = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' +export const PROGRAM_ADDRESS = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'; /** * Program public key @@ -18,4 +18,4 @@ export const PROGRAM_ADDRESS = 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' * @category constants * @category generated */ -export const PROGRAM_ID = new PublicKey(PROGRAM_ADDRESS) +export const PROGRAM_ID = new PublicKey(PROGRAM_ADDRESS); diff --git a/clients/js-solita/src/generated/instructions/burn.ts b/clients/js-solita/src/generated/instructions/burn.ts index 1ecbab45..3bb9adb4 100644 --- a/clients/js-solita/src/generated/instructions/burn.ts +++ b/clients/js-solita/src/generated/instructions/burn.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js' * @category generated */ export type BurnInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; +}; /** * @category Instructions * @category Burn @@ -27,7 +27,7 @@ export type BurnInstructionArgs = { */ export const burnStruct = new beet.BeetArgsStruct< BurnInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -38,8 +38,8 @@ export const burnStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'BurnInstructionArgs' -) + 'BurnInstructionArgs', +); /** * Accounts required by the _burn_ instruction * @@ -54,17 +54,17 @@ export const burnStruct = new beet.BeetArgsStruct< * @category generated */ export type BurnInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const burnInstructionDiscriminator = [116, 110, 29, 56, 107, 219, 42, 93] +export const burnInstructionDiscriminator = [116, 110, 29, 56, 107, 219, 42, 93]; /** * Creates a _Burn_ instruction. @@ -79,12 +79,12 @@ export const burnInstructionDiscriminator = [116, 110, 29, 56, 107, 219, 42, 93] export function createBurnInstruction( accounts: BurnInstructionAccounts, args: BurnInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = burnStruct.serialize({ instructionDiscriminator: burnInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -121,11 +121,11 @@ export function createBurnInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -133,6 +133,6 @@ export function createBurnInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/cancelRedeem.ts b/clients/js-solita/src/generated/instructions/cancelRedeem.ts index 37479340..875fad85 100644 --- a/clients/js-solita/src/generated/instructions/cancelRedeem.ts +++ b/clients/js-solita/src/generated/instructions/cancelRedeem.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,8 +14,8 @@ import * as web3 from '@solana/web3.js' * @category generated */ export type CancelRedeemInstructionArgs = { - root: number[] /* size: 32 */ -} + root: number[] /* size: 32 */; +}; /** * @category Instructions * @category CancelRedeem @@ -23,15 +23,15 @@ export type CancelRedeemInstructionArgs = { */ export const cancelRedeemStruct = new beet.BeetArgsStruct< CancelRedeemInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['root', beet.uniformFixedSizeArray(beet.u8, 32)], ], - 'CancelRedeemInstructionArgs' -) + 'CancelRedeemInstructionArgs', +); /** * Accounts required by the _cancelRedeem_ instruction * @@ -46,19 +46,17 @@ export const cancelRedeemStruct = new beet.BeetArgsStruct< * @category generated */ export type CancelRedeemInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - merkleTree: web3.PublicKey - voucher: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + merkleTree: web3.PublicKey; + voucher: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const cancelRedeemInstructionDiscriminator = [ - 111, 76, 232, 50, 39, 175, 48, 242, -] +export const cancelRedeemInstructionDiscriminator = [111, 76, 232, 50, 39, 175, 48, 242]; /** * Creates a _CancelRedeem_ instruction. @@ -73,12 +71,12 @@ export const cancelRedeemInstructionDiscriminator = [ export function createCancelRedeemInstruction( accounts: CancelRedeemInstructionAccounts, args: CancelRedeemInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = cancelRedeemStruct.serialize({ instructionDiscriminator: cancelRedeemInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -115,11 +113,11 @@ export function createCancelRedeemInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -127,6 +125,6 @@ export function createCancelRedeemInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/compress.ts b/clients/js-solita/src/generated/instructions/compress.ts index 8265cdef..69e301b4 100644 --- a/clients/js-solita/src/generated/instructions/compress.ts +++ b/clients/js-solita/src/generated/instructions/compress.ts @@ -5,9 +5,9 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as splToken from '@solana/spl-token'; +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -15,11 +15,11 @@ import * as web3 from '@solana/web3.js' * @category generated */ export const compressStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; }>( [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CompressInstructionArgs' -) + 'CompressInstructionArgs', +); /** * Accounts required by the _compress_ instruction * @@ -40,26 +40,24 @@ export const compressStruct = new beet.BeetArgsStruct<{ * @category generated */ export type CompressInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - tokenAccount: web3.PublicKey - mint: web3.PublicKey - metadata: web3.PublicKey - masterEdition: web3.PublicKey - payer: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenProgram?: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + tokenAccount: web3.PublicKey; + mint: web3.PublicKey; + metadata: web3.PublicKey; + masterEdition: web3.PublicKey; + payer: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenProgram?: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const compressInstructionDiscriminator = [ - 82, 193, 176, 117, 176, 21, 115, 253, -] +export const compressInstructionDiscriminator = [82, 193, 176, 117, 176, 21, 115, 253]; /** * Creates a _Compress_ instruction. @@ -71,11 +69,11 @@ export const compressInstructionDiscriminator = [ */ export function createCompressInstruction( accounts: CompressInstructionAccounts, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = compressStruct.serialize({ instructionDiscriminator: compressInstructionDiscriminator, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -147,11 +145,11 @@ export function createCompressInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -159,6 +157,6 @@ export function createCompressInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/createTree.ts b/clients/js-solita/src/generated/instructions/createTree.ts index 2bc1d49f..0534051f 100644 --- a/clients/js-solita/src/generated/instructions/createTree.ts +++ b/clients/js-solita/src/generated/instructions/createTree.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,10 +14,10 @@ import * as web3 from '@solana/web3.js' * @category generated */ export type CreateTreeInstructionArgs = { - maxDepth: number - maxBufferSize: number - public: beet.COption -} + maxDepth: number; + maxBufferSize: number; + public: beet.COption; +}; /** * @category Instructions * @category CreateTree @@ -25,7 +25,7 @@ export type CreateTreeInstructionArgs = { */ export const createTreeStruct = new beet.FixableBeetArgsStruct< CreateTreeInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -34,8 +34,8 @@ export const createTreeStruct = new beet.FixableBeetArgsStruct< ['maxBufferSize', beet.u32], ['public', beet.coption(beet.bool)], ], - 'CreateTreeInstructionArgs' -) + 'CreateTreeInstructionArgs', +); /** * Accounts required by the _createTree_ instruction * @@ -50,19 +50,17 @@ export const createTreeStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type CreateTreeInstructionAccounts = { - treeAuthority: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - treeCreator: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + treeCreator: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const createTreeInstructionDiscriminator = [ - 165, 83, 136, 142, 89, 202, 47, 220, -] +export const createTreeInstructionDiscriminator = [165, 83, 136, 142, 89, 202, 47, 220]; /** * Creates a _CreateTree_ instruction. @@ -77,12 +75,12 @@ export const createTreeInstructionDiscriminator = [ export function createCreateTreeInstruction( accounts: CreateTreeInstructionAccounts, args: CreateTreeInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = createTreeStruct.serialize({ instructionDiscriminator: createTreeInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -119,11 +117,11 @@ export function createCreateTreeInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -131,6 +129,6 @@ export function createCreateTreeInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/decompressV1.ts b/clients/js-solita/src/generated/instructions/decompressV1.ts index e2887975..a090d580 100644 --- a/clients/js-solita/src/generated/instructions/decompressV1.ts +++ b/clients/js-solita/src/generated/instructions/decompressV1.ts @@ -5,10 +5,10 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' +import * as splToken from '@solana/spl-token'; +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -16,8 +16,8 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type DecompressV1InstructionArgs = { - metadata: MetadataArgs -} + metadata: MetadataArgs; +}; /** * @category Instructions * @category DecompressV1 @@ -25,15 +25,15 @@ export type DecompressV1InstructionArgs = { */ export const decompressV1Struct = new beet.FixableBeetArgsStruct< DecompressV1InstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['metadata', metadataArgsBeet], ], - 'DecompressV1InstructionArgs' -) + 'DecompressV1InstructionArgs', +); /** * Accounts required by the _decompressV1_ instruction * @@ -53,25 +53,23 @@ export const decompressV1Struct = new beet.FixableBeetArgsStruct< * @category generated */ export type DecompressV1InstructionAccounts = { - voucher: web3.PublicKey - leafOwner: web3.PublicKey - tokenAccount: web3.PublicKey - mint: web3.PublicKey - mintAuthority: web3.PublicKey - metadata: web3.PublicKey - masterEdition: web3.PublicKey - systemProgram?: web3.PublicKey - sysvarRent: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - tokenProgram?: web3.PublicKey - associatedTokenProgram: web3.PublicKey - logWrapper: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + voucher: web3.PublicKey; + leafOwner: web3.PublicKey; + tokenAccount: web3.PublicKey; + mint: web3.PublicKey; + mintAuthority: web3.PublicKey; + metadata: web3.PublicKey; + masterEdition: web3.PublicKey; + systemProgram?: web3.PublicKey; + sysvarRent: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + tokenProgram?: web3.PublicKey; + associatedTokenProgram: web3.PublicKey; + logWrapper: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const decompressV1InstructionDiscriminator = [ - 54, 85, 76, 70, 228, 250, 164, 81, -] +export const decompressV1InstructionDiscriminator = [54, 85, 76, 70, 228, 250, 164, 81]; /** * Creates a _DecompressV1_ instruction. @@ -86,12 +84,12 @@ export const decompressV1InstructionDiscriminator = [ export function createDecompressV1Instruction( accounts: DecompressV1InstructionAccounts, args: DecompressV1InstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = decompressV1Struct.serialize({ instructionDiscriminator: decompressV1InstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.voucher, @@ -158,11 +156,11 @@ export function createDecompressV1Instruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -170,6 +168,6 @@ export function createDecompressV1Instruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/delegate.ts b/clients/js-solita/src/generated/instructions/delegate.ts index c4341c89..a59a35a2 100644 --- a/clients/js-solita/src/generated/instructions/delegate.ts +++ b/clients/js-solita/src/generated/instructions/delegate.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js' * @category generated */ export type DelegateInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; +}; /** * @category Instructions * @category Delegate @@ -27,7 +27,7 @@ export type DelegateInstructionArgs = { */ export const delegateStruct = new beet.BeetArgsStruct< DelegateInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -38,8 +38,8 @@ export const delegateStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'DelegateInstructionArgs' -) + 'DelegateInstructionArgs', +); /** * Accounts required by the _delegate_ instruction * @@ -55,20 +55,18 @@ export const delegateStruct = new beet.BeetArgsStruct< * @category generated */ export type DelegateInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - previousLeafDelegate: web3.PublicKey - newLeafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + previousLeafDelegate: web3.PublicKey; + newLeafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const delegateInstructionDiscriminator = [ - 90, 147, 75, 178, 85, 88, 4, 137, -] +export const delegateInstructionDiscriminator = [90, 147, 75, 178, 85, 88, 4, 137]; /** * Creates a _Delegate_ instruction. @@ -83,12 +81,12 @@ export const delegateInstructionDiscriminator = [ export function createDelegateInstruction( accounts: DelegateInstructionAccounts, args: DelegateInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = delegateStruct.serialize({ instructionDiscriminator: delegateInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -130,11 +128,11 @@ export function createDelegateInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -142,6 +140,6 @@ export function createDelegateInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/index.ts b/clients/js-solita/src/generated/instructions/index.ts index 142057f9..0097b597 100644 --- a/clients/js-solita/src/generated/instructions/index.ts +++ b/clients/js-solita/src/generated/instructions/index.ts @@ -13,7 +13,7 @@ export * from './setTreeDelegate'; export * from './transfer'; export * from './unverifyCollection'; export * from './unverifyCreator'; -export * from './updateMetadata' -export * from './updateMetadataCollectionNft' +export * from './updateMetadata'; +export * from './updateMetadataCollectionNft'; export * from './verifyCollection'; export * from './verifyCreator'; diff --git a/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts b/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts index 80aba2af..fd27b155 100644 --- a/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts +++ b/clients/js-solita/src/generated/instructions/mintToCollectionV1.ts @@ -5,9 +5,9 @@ * 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' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -15,8 +15,8 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type MintToCollectionV1InstructionArgs = { - metadataArgs: MetadataArgs -} + metadataArgs: MetadataArgs; +}; /** * @category Instructions * @category MintToCollectionV1 @@ -24,15 +24,15 @@ export type MintToCollectionV1InstructionArgs = { */ export const mintToCollectionV1Struct = new beet.FixableBeetArgsStruct< MintToCollectionV1InstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['metadataArgs', metadataArgsBeet], ], - 'MintToCollectionV1InstructionArgs' -) + 'MintToCollectionV1InstructionArgs', +); /** * Accounts required by the _mintToCollectionV1_ instruction * @@ -56,28 +56,26 @@ export const mintToCollectionV1Struct = new beet.FixableBeetArgsStruct< * @category generated */ export type MintToCollectionV1InstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - treeDelegate: web3.PublicKey - collectionAuthority: web3.PublicKey - collectionAuthorityRecordPda: web3.PublicKey - collectionMint: web3.PublicKey - collectionMetadata: web3.PublicKey - editionAccount: web3.PublicKey - bubblegumSigner: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + treeDelegate: web3.PublicKey; + collectionAuthority: web3.PublicKey; + collectionAuthorityRecordPda: web3.PublicKey; + collectionMint: web3.PublicKey; + collectionMetadata: web3.PublicKey; + editionAccount: web3.PublicKey; + bubblegumSigner: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const mintToCollectionV1InstructionDiscriminator = [ - 153, 18, 178, 47, 197, 158, 86, 15, -] +export const mintToCollectionV1InstructionDiscriminator = [153, 18, 178, 47, 197, 158, 86, 15]; /** * Creates a _MintToCollectionV1_ instruction. @@ -92,12 +90,12 @@ export const mintToCollectionV1InstructionDiscriminator = [ export function createMintToCollectionV1Instruction( accounts: MintToCollectionV1InstructionAccounts, args: MintToCollectionV1InstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = mintToCollectionV1Struct.serialize({ instructionDiscriminator: mintToCollectionV1InstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -179,11 +177,11 @@ export function createMintToCollectionV1Instruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -191,6 +189,6 @@ export function createMintToCollectionV1Instruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/mintV1.ts b/clients/js-solita/src/generated/instructions/mintV1.ts index f54c8cac..1a737897 100644 --- a/clients/js-solita/src/generated/instructions/mintV1.ts +++ b/clients/js-solita/src/generated/instructions/mintV1.ts @@ -5,9 +5,9 @@ * 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' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -15,8 +15,8 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type MintV1InstructionArgs = { - message: MetadataArgs -} + message: MetadataArgs; +}; /** * @category Instructions * @category MintV1 @@ -24,15 +24,15 @@ export type MintV1InstructionArgs = { */ export const mintV1Struct = new beet.FixableBeetArgsStruct< MintV1InstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['message', metadataArgsBeet], ], - 'MintV1InstructionArgs' -) + 'MintV1InstructionArgs', +); /** * Accounts required by the _mintV1_ instruction * @@ -49,21 +49,19 @@ export const mintV1Struct = new beet.FixableBeetArgsStruct< * @category generated */ export type MintV1InstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - treeDelegate: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + treeDelegate: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const mintV1InstructionDiscriminator = [ - 145, 98, 192, 118, 184, 147, 118, 104, -] +export const mintV1InstructionDiscriminator = [145, 98, 192, 118, 184, 147, 118, 104]; /** * Creates a _MintV1_ instruction. @@ -78,12 +76,12 @@ export const mintV1InstructionDiscriminator = [ export function createMintV1Instruction( accounts: MintV1InstructionAccounts, args: MintV1InstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = mintV1Struct.serialize({ instructionDiscriminator: mintV1InstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -130,11 +128,11 @@ export function createMintV1Instruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -142,6 +140,6 @@ export function createMintV1Instruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/redeem.ts b/clients/js-solita/src/generated/instructions/redeem.ts index 28bd12bc..c4f82e4c 100644 --- a/clients/js-solita/src/generated/instructions/redeem.ts +++ b/clients/js-solita/src/generated/instructions/redeem.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js' * @category generated */ export type RedeemInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; +}; /** * @category Instructions * @category Redeem @@ -27,7 +27,7 @@ export type RedeemInstructionArgs = { */ export const redeemStruct = new beet.BeetArgsStruct< RedeemInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -38,8 +38,8 @@ export const redeemStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'RedeemInstructionArgs' -) + 'RedeemInstructionArgs', +); /** * Accounts required by the _redeem_ instruction * @@ -55,20 +55,18 @@ export const redeemStruct = new beet.BeetArgsStruct< * @category generated */ export type RedeemInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - voucher: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + voucher: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const redeemInstructionDiscriminator = [ - 184, 12, 86, 149, 70, 196, 97, 225, -] +export const redeemInstructionDiscriminator = [184, 12, 86, 149, 70, 196, 97, 225]; /** * Creates a _Redeem_ instruction. @@ -83,12 +81,12 @@ export const redeemInstructionDiscriminator = [ export function createRedeemInstruction( accounts: RedeemInstructionAccounts, args: RedeemInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = redeemStruct.serialize({ instructionDiscriminator: redeemInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -130,11 +128,11 @@ export function createRedeemInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -142,6 +140,6 @@ export function createRedeemInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts b/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts index 240d91e4..48cd8287 100644 --- a/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts +++ b/clients/js-solita/src/generated/instructions/setAndVerifyCollection.ts @@ -5,10 +5,10 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import * as beetSolana from '@metaplex-foundation/beet-solana'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -16,14 +16,14 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @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: web3.PublicKey -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; + message: MetadataArgs; + collection: web3.PublicKey; +}; /** * @category Instructions * @category SetAndVerifyCollection @@ -31,7 +31,7 @@ export type SetAndVerifyCollectionInstructionArgs = { */ export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct< SetAndVerifyCollectionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -44,8 +44,8 @@ export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct< ['message', metadataArgsBeet], ['collection', beetSolana.publicKey], ], - 'SetAndVerifyCollectionInstructionArgs' -) + 'SetAndVerifyCollectionInstructionArgs', +); /** * Accounts required by the _setAndVerifyCollection_ instruction * @@ -69,28 +69,28 @@ export const setAndVerifyCollectionStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type SetAndVerifyCollectionInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - treeDelegate: web3.PublicKey - collectionAuthority: web3.PublicKey - collectionAuthorityRecordPda: web3.PublicKey - collectionMint: web3.PublicKey - collectionMetadata: web3.PublicKey - editionAccount: web3.PublicKey - bubblegumSigner: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + treeDelegate: web3.PublicKey; + collectionAuthority: web3.PublicKey; + collectionAuthorityRecordPda: web3.PublicKey; + collectionMint: web3.PublicKey; + collectionMetadata: web3.PublicKey; + editionAccount: web3.PublicKey; + bubblegumSigner: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; export const setAndVerifyCollectionInstructionDiscriminator = [ 235, 242, 121, 216, 158, 234, 180, 234, -] +]; /** * Creates a _SetAndVerifyCollection_ instruction. @@ -105,12 +105,12 @@ export const setAndVerifyCollectionInstructionDiscriminator = [ export function createSetAndVerifyCollectionInstruction( accounts: SetAndVerifyCollectionInstructionAccounts, args: SetAndVerifyCollectionInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = setAndVerifyCollectionStruct.serialize({ instructionDiscriminator: setAndVerifyCollectionInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -192,11 +192,11 @@ export function createSetAndVerifyCollectionInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -204,6 +204,6 @@ export function createSetAndVerifyCollectionInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/setTreeDelegate.ts b/clients/js-solita/src/generated/instructions/setTreeDelegate.ts index eae00152..c53d3f88 100644 --- a/clients/js-solita/src/generated/instructions/setTreeDelegate.ts +++ b/clients/js-solita/src/generated/instructions/setTreeDelegate.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,11 +14,11 @@ import * as web3 from '@solana/web3.js' * @category generated */ export const setTreeDelegateStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; }>( [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'SetTreeDelegateInstructionArgs' -) + 'SetTreeDelegateInstructionArgs', +); /** * Accounts required by the _setTreeDelegate_ instruction * @@ -31,17 +31,15 @@ export const setTreeDelegateStruct = new beet.BeetArgsStruct<{ * @category generated */ export type SetTreeDelegateInstructionAccounts = { - treeAuthority: web3.PublicKey - treeCreator: web3.PublicKey - newTreeDelegate: web3.PublicKey - merkleTree: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + treeCreator: web3.PublicKey; + newTreeDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const setTreeDelegateInstructionDiscriminator = [ - 253, 118, 66, 37, 190, 49, 154, 102, -] +export const setTreeDelegateInstructionDiscriminator = [253, 118, 66, 37, 190, 49, 154, 102]; /** * Creates a _SetTreeDelegate_ instruction. @@ -53,11 +51,11 @@ export const setTreeDelegateInstructionDiscriminator = [ */ export function createSetTreeDelegateInstruction( accounts: SetTreeDelegateInstructionAccounts, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = setTreeDelegateStruct.serialize({ instructionDiscriminator: setTreeDelegateInstructionDiscriminator, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -84,11 +82,11 @@ export function createSetTreeDelegateInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -96,6 +94,6 @@ export function createSetTreeDelegateInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/transfer.ts b/clients/js-solita/src/generated/instructions/transfer.ts index b6f919b7..d43d4301 100644 --- a/clients/js-solita/src/generated/instructions/transfer.ts +++ b/clients/js-solita/src/generated/instructions/transfer.ts @@ -5,8 +5,8 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; /** * @category Instructions @@ -14,12 +14,12 @@ import * as web3 from '@solana/web3.js' * @category generated */ export type TransferInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; +}; /** * @category Instructions * @category Transfer @@ -27,7 +27,7 @@ export type TransferInstructionArgs = { */ export const transferStruct = new beet.BeetArgsStruct< TransferInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -38,8 +38,8 @@ export const transferStruct = new beet.BeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'TransferInstructionArgs' -) + 'TransferInstructionArgs', +); /** * Accounts required by the _transfer_ instruction * @@ -55,20 +55,18 @@ export const transferStruct = new beet.BeetArgsStruct< * @category generated */ export type TransferInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - newLeafOwner: web3.PublicKey - merkleTree: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + newLeafOwner: web3.PublicKey; + merkleTree: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const transferInstructionDiscriminator = [ - 163, 52, 200, 231, 140, 3, 69, 186, -] +export const transferInstructionDiscriminator = [163, 52, 200, 231, 140, 3, 69, 186]; /** * Creates a _Transfer_ instruction. @@ -83,12 +81,12 @@ export const transferInstructionDiscriminator = [ export function createTransferInstruction( accounts: TransferInstructionAccounts, args: TransferInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = transferStruct.serialize({ instructionDiscriminator: transferInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -130,11 +128,11 @@ export function createTransferInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -142,6 +140,6 @@ export function createTransferInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/unverifyCollection.ts b/clients/js-solita/src/generated/instructions/unverifyCollection.ts index 34efda73..86ddc0ef 100644 --- a/clients/js-solita/src/generated/instructions/unverifyCollection.ts +++ b/clients/js-solita/src/generated/instructions/unverifyCollection.ts @@ -5,9 +5,9 @@ * 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' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type UnverifyCollectionInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number - message: MetadataArgs -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; + message: MetadataArgs; +}; /** * @category Instructions * @category UnverifyCollection @@ -29,7 +29,7 @@ export type UnverifyCollectionInstructionArgs = { */ export const unverifyCollectionStruct = new beet.FixableBeetArgsStruct< UnverifyCollectionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -41,8 +41,8 @@ export const unverifyCollectionStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'UnverifyCollectionInstructionArgs' -) + 'UnverifyCollectionInstructionArgs', +); /** * Accounts required by the _unverifyCollection_ instruction * @@ -66,28 +66,26 @@ export const unverifyCollectionStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UnverifyCollectionInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - treeDelegate: web3.PublicKey - collectionAuthority: web3.PublicKey - collectionAuthorityRecordPda: web3.PublicKey - collectionMint: web3.PublicKey - collectionMetadata: web3.PublicKey - editionAccount: web3.PublicKey - bubblegumSigner: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + treeDelegate: web3.PublicKey; + collectionAuthority: web3.PublicKey; + collectionAuthorityRecordPda: web3.PublicKey; + collectionMint: web3.PublicKey; + collectionMetadata: web3.PublicKey; + editionAccount: web3.PublicKey; + bubblegumSigner: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const unverifyCollectionInstructionDiscriminator = [ - 250, 251, 42, 106, 41, 137, 186, 168, -] +export const unverifyCollectionInstructionDiscriminator = [250, 251, 42, 106, 41, 137, 186, 168]; /** * Creates a _UnverifyCollection_ instruction. @@ -102,12 +100,12 @@ export const unverifyCollectionInstructionDiscriminator = [ export function createUnverifyCollectionInstruction( accounts: UnverifyCollectionInstructionAccounts, args: UnverifyCollectionInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = unverifyCollectionStruct.serialize({ instructionDiscriminator: unverifyCollectionInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -189,11 +187,11 @@ export function createUnverifyCollectionInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -201,6 +199,6 @@ export function createUnverifyCollectionInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/unverifyCreator.ts b/clients/js-solita/src/generated/instructions/unverifyCreator.ts index 7c8a1aeb..be34bbbb 100644 --- a/clients/js-solita/src/generated/instructions/unverifyCreator.ts +++ b/clients/js-solita/src/generated/instructions/unverifyCreator.ts @@ -5,9 +5,9 @@ * 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' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type UnverifyCreatorInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number - message: MetadataArgs -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; + message: MetadataArgs; +}; /** * @category Instructions * @category UnverifyCreator @@ -29,7 +29,7 @@ export type UnverifyCreatorInstructionArgs = { */ export const unverifyCreatorStruct = new beet.FixableBeetArgsStruct< UnverifyCreatorInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -41,8 +41,8 @@ export const unverifyCreatorStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'UnverifyCreatorInstructionArgs' -) + 'UnverifyCreatorInstructionArgs', +); /** * Accounts required by the _unverifyCreator_ instruction * @@ -59,21 +59,19 @@ export const unverifyCreatorStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UnverifyCreatorInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - creator: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + creator: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const unverifyCreatorInstructionDiscriminator = [ - 107, 178, 57, 39, 105, 115, 112, 152, -] +export const unverifyCreatorInstructionDiscriminator = [107, 178, 57, 39, 105, 115, 112, 152]; /** * Creates a _UnverifyCreator_ instruction. @@ -88,12 +86,12 @@ export const unverifyCreatorInstructionDiscriminator = [ export function createUnverifyCreatorInstruction( accounts: UnverifyCreatorInstructionAccounts, args: UnverifyCreatorInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = unverifyCreatorStruct.serialize({ instructionDiscriminator: unverifyCreatorInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -140,11 +138,11 @@ export function createUnverifyCreatorInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -152,6 +150,6 @@ export function createUnverifyCreatorInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/updateMetadata.ts b/clients/js-solita/src/generated/instructions/updateMetadata.ts index 935ffd01..9be1bf7a 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadata.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadata.ts @@ -5,10 +5,10 @@ * 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' -import { Creator, creatorBeet } from '../types/Creator' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; +import { Creator, creatorBeet } from '../types/Creator'; /** * @category Instructions @@ -16,18 +16,18 @@ import { Creator, creatorBeet } from '../types/Creator' * @category generated */ export type UpdateMetadataInstructionArgs = { - root: number[] /* size: 32 */ - oldMetadata: beet.COption - newName: beet.COption - newSymbol: beet.COption - newUri: beet.COption - newCreators: beet.COption - newSellerFeeBasisPoints: beet.COption - newPrimarySaleHappened: beet.COption - newIsMutable: beet.COption - nonce: beet.bignum - index: number -} + root: number[] /* size: 32 */; + oldMetadata: beet.COption; + newName: beet.COption; + newSymbol: beet.COption; + newUri: beet.COption; + newCreators: beet.COption; + newSellerFeeBasisPoints: beet.COption; + newPrimarySaleHappened: beet.COption; + newIsMutable: beet.COption; + nonce: beet.bignum; + index: number; +}; /** * @category Instructions * @category UpdateMetadata @@ -35,7 +35,7 @@ export type UpdateMetadataInstructionArgs = { */ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< UpdateMetadataInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -52,8 +52,8 @@ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'UpdateMetadataInstructionArgs' -) + 'UpdateMetadataInstructionArgs', +); /** * Accounts required by the _updateMetadata_ instruction * @@ -72,23 +72,21 @@ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UpdateMetadataInstructionAccounts = { - oldMetadataAcct: web3.PublicKey - treeAuthority: web3.PublicKey - treeDelegate: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - payer: web3.PublicKey - merkleTree: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + oldMetadataAcct: web3.PublicKey; + treeAuthority: web3.PublicKey; + treeDelegate: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + payer: web3.PublicKey; + merkleTree: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const updateMetadataInstructionDiscriminator = [ - 170, 182, 43, 239, 97, 78, 225, 186, -] +export const updateMetadataInstructionDiscriminator = [170, 182, 43, 239, 97, 78, 225, 186]; /** * Creates a _UpdateMetadata_ instruction. @@ -103,12 +101,12 @@ export const updateMetadataInstructionDiscriminator = [ export function createUpdateMetadataInstruction( accounts: UpdateMetadataInstructionAccounts, args: UpdateMetadataInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = updateMetadataStruct.serialize({ instructionDiscriminator: updateMetadataInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.oldMetadataAcct, @@ -165,11 +163,11 @@ export function createUpdateMetadataInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -177,6 +175,6 @@ export function createUpdateMetadataInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts index afa391ea..80e9f13b 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts @@ -5,10 +5,10 @@ * 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' -import { Creator, creatorBeet } from '../types/Creator' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; +import { Creator, creatorBeet } from '../types/Creator'; /** * @category Instructions @@ -16,18 +16,18 @@ import { Creator, creatorBeet } from '../types/Creator' * @category generated */ export type UpdateMetadataCollectionNftInstructionArgs = { - root: number[] /* size: 32 */ - oldMetadata: beet.COption - newName: beet.COption - newSymbol: beet.COption - newUri: beet.COption - newCreators: beet.COption - newSellerFeeBasisPoints: beet.COption - newPrimarySaleHappened: beet.COption - newIsMutable: beet.COption - nonce: beet.bignum - index: number -} + root: number[] /* size: 32 */; + oldMetadata: beet.COption; + newName: beet.COption; + newSymbol: beet.COption; + newUri: beet.COption; + newCreators: beet.COption; + newSellerFeeBasisPoints: beet.COption; + newPrimarySaleHappened: beet.COption; + newIsMutable: beet.COption; + nonce: beet.bignum; + index: number; +}; /** * @category Instructions * @category UpdateMetadataCollectionNft @@ -35,7 +35,7 @@ export type UpdateMetadataCollectionNftInstructionArgs = { */ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< UpdateMetadataCollectionNftInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -52,8 +52,8 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< ['nonce', beet.u64], ['index', beet.u32], ], - 'UpdateMetadataCollectionNftInstructionArgs' -) + 'UpdateMetadataCollectionNftInstructionArgs', +); /** * Accounts required by the _updateMetadataCollectionNft_ instruction * @@ -76,27 +76,27 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UpdateMetadataCollectionNftInstructionAccounts = { - oldMetadataAcct: web3.PublicKey - treeAuthority: web3.PublicKey - treeDelegate: web3.PublicKey - collectionAuthority: web3.PublicKey - collectionMint: web3.PublicKey - collectionMetadata: web3.PublicKey - collectionAuthorityRecordPda: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - payer: web3.PublicKey - merkleTree: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + oldMetadataAcct: web3.PublicKey; + treeAuthority: web3.PublicKey; + treeDelegate: web3.PublicKey; + collectionAuthority: web3.PublicKey; + collectionMint: web3.PublicKey; + collectionMetadata: web3.PublicKey; + collectionAuthorityRecordPda: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + payer: web3.PublicKey; + merkleTree: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; export const updateMetadataCollectionNftInstructionDiscriminator = [ 244, 12, 175, 194, 227, 28, 102, 215, -] +]; /** * Creates a _UpdateMetadataCollectionNft_ instruction. @@ -111,13 +111,12 @@ export const updateMetadataCollectionNftInstructionDiscriminator = [ export function createUpdateMetadataCollectionNftInstruction( accounts: UpdateMetadataCollectionNftInstructionAccounts, args: UpdateMetadataCollectionNftInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = updateMetadataCollectionNftStruct.serialize({ - instructionDiscriminator: - updateMetadataCollectionNftInstructionDiscriminator, + instructionDiscriminator: updateMetadataCollectionNftInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.oldMetadataAcct, @@ -194,11 +193,11 @@ export function createUpdateMetadataCollectionNftInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -206,6 +205,6 @@ export function createUpdateMetadataCollectionNftInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/verifyCollection.ts b/clients/js-solita/src/generated/instructions/verifyCollection.ts index 3c525894..cec59b74 100644 --- a/clients/js-solita/src/generated/instructions/verifyCollection.ts +++ b/clients/js-solita/src/generated/instructions/verifyCollection.ts @@ -5,9 +5,9 @@ * 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' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type VerifyCollectionInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number - message: MetadataArgs -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; + message: MetadataArgs; +}; /** * @category Instructions * @category VerifyCollection @@ -29,7 +29,7 @@ export type VerifyCollectionInstructionArgs = { */ export const verifyCollectionStruct = new beet.FixableBeetArgsStruct< VerifyCollectionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -41,8 +41,8 @@ export const verifyCollectionStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'VerifyCollectionInstructionArgs' -) + 'VerifyCollectionInstructionArgs', +); /** * Accounts required by the _verifyCollection_ instruction * @@ -66,28 +66,26 @@ export const verifyCollectionStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type VerifyCollectionInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - treeDelegate: web3.PublicKey - collectionAuthority: web3.PublicKey - collectionAuthorityRecordPda: web3.PublicKey - collectionMint: web3.PublicKey - collectionMetadata: web3.PublicKey - editionAccount: web3.PublicKey - bubblegumSigner: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + treeDelegate: web3.PublicKey; + collectionAuthority: web3.PublicKey; + collectionAuthorityRecordPda: web3.PublicKey; + collectionMint: web3.PublicKey; + collectionMetadata: web3.PublicKey; + editionAccount: web3.PublicKey; + bubblegumSigner: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + tokenMetadataProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const verifyCollectionInstructionDiscriminator = [ - 56, 113, 101, 253, 79, 55, 122, 169, -] +export const verifyCollectionInstructionDiscriminator = [56, 113, 101, 253, 79, 55, 122, 169]; /** * Creates a _VerifyCollection_ instruction. @@ -102,12 +100,12 @@ export const verifyCollectionInstructionDiscriminator = [ export function createVerifyCollectionInstruction( accounts: VerifyCollectionInstructionAccounts, args: VerifyCollectionInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = verifyCollectionStruct.serialize({ instructionDiscriminator: verifyCollectionInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -189,11 +187,11 @@ export function createVerifyCollectionInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -201,6 +199,6 @@ export function createVerifyCollectionInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/instructions/verifyCreator.ts b/clients/js-solita/src/generated/instructions/verifyCreator.ts index 8fa05723..326432df 100644 --- a/clients/js-solita/src/generated/instructions/verifyCreator.ts +++ b/clients/js-solita/src/generated/instructions/verifyCreator.ts @@ -5,9 +5,9 @@ * 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' +import * as beet from '@metaplex-foundation/beet'; +import * as web3 from '@solana/web3.js'; +import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; /** * @category Instructions @@ -15,13 +15,13 @@ import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs' * @category generated */ export type VerifyCreatorInstructionArgs = { - root: number[] /* size: 32 */ - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - nonce: beet.bignum - index: number - message: MetadataArgs -} + root: number[] /* size: 32 */; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; + message: MetadataArgs; +}; /** * @category Instructions * @category VerifyCreator @@ -29,7 +29,7 @@ export type VerifyCreatorInstructionArgs = { */ export const verifyCreatorStruct = new beet.FixableBeetArgsStruct< VerifyCreatorInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ + instructionDiscriminator: number[] /* size: 8 */; } >( [ @@ -41,8 +41,8 @@ export const verifyCreatorStruct = new beet.FixableBeetArgsStruct< ['index', beet.u32], ['message', metadataArgsBeet], ], - 'VerifyCreatorInstructionArgs' -) + 'VerifyCreatorInstructionArgs', +); /** * Accounts required by the _verifyCreator_ instruction * @@ -59,21 +59,19 @@ export const verifyCreatorStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type VerifyCreatorInstructionAccounts = { - treeAuthority: web3.PublicKey - leafOwner: web3.PublicKey - leafDelegate: web3.PublicKey - merkleTree: web3.PublicKey - payer: web3.PublicKey - creator: web3.PublicKey - logWrapper: web3.PublicKey - compressionProgram: web3.PublicKey - systemProgram?: web3.PublicKey - anchorRemainingAccounts?: web3.AccountMeta[] -} + treeAuthority: web3.PublicKey; + leafOwner: web3.PublicKey; + leafDelegate: web3.PublicKey; + merkleTree: web3.PublicKey; + payer: web3.PublicKey; + creator: web3.PublicKey; + logWrapper: web3.PublicKey; + compressionProgram: web3.PublicKey; + systemProgram?: web3.PublicKey; + anchorRemainingAccounts?: web3.AccountMeta[]; +}; -export const verifyCreatorInstructionDiscriminator = [ - 52, 17, 96, 132, 71, 4, 85, 194, -] +export const verifyCreatorInstructionDiscriminator = [52, 17, 96, 132, 71, 4, 85, 194]; /** * Creates a _VerifyCreator_ instruction. @@ -88,12 +86,12 @@ export const verifyCreatorInstructionDiscriminator = [ export function createVerifyCreatorInstruction( accounts: VerifyCreatorInstructionAccounts, args: VerifyCreatorInstructionArgs, - programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY') + programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'), ) { const [data] = verifyCreatorStruct.serialize({ instructionDiscriminator: verifyCreatorInstructionDiscriminator, ...args, - }) + }); const keys: web3.AccountMeta[] = [ { pubkey: accounts.treeAuthority, @@ -140,11 +138,11 @@ export function createVerifyCreatorInstruction( isWritable: false, isSigner: false, }, - ] + ]; if (accounts.anchorRemainingAccounts != null) { for (const acc of accounts.anchorRemainingAccounts) { - keys.push(acc) + keys.push(acc); } } @@ -152,6 +150,6 @@ export function createVerifyCreatorInstruction( programId, keys, data, - }) - return ix + }); + return ix; } diff --git a/clients/js-solita/src/generated/types/BubblegumEventType.ts b/clients/js-solita/src/generated/types/BubblegumEventType.ts index 398515e7..4664cf8d 100644 --- a/clients/js-solita/src/generated/types/BubblegumEventType.ts +++ b/clients/js-solita/src/generated/types/BubblegumEventType.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' +import * as beet from '@metaplex-foundation/beet'; /** * @category enums * @category generated @@ -20,5 +20,5 @@ export enum BubblegumEventType { * @category generated */ export const bubblegumEventTypeBeet = beet.fixedScalarEnum( - BubblegumEventType -) as beet.FixedSizeBeet + BubblegumEventType, +) as beet.FixedSizeBeet; diff --git a/clients/js-solita/src/generated/types/Collection.ts b/clients/js-solita/src/generated/types/Collection.ts index f7402e06..eb5c48a1 100644 --- a/clients/js-solita/src/generated/types/Collection.ts +++ b/clients/js-solita/src/generated/types/Collection.ts @@ -5,13 +5,13 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' +import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet'; +import * as beetSolana from '@metaplex-foundation/beet-solana'; export type Collection = { - verified: boolean - key: web3.PublicKey -} + verified: boolean; + key: web3.PublicKey; +}; /** * @category userTypes @@ -22,5 +22,5 @@ export const collectionBeet = new beet.BeetArgsStruct( ['verified', beet.bool], ['key', beetSolana.publicKey], ], - 'Collection' -) + 'Collection', +); diff --git a/clients/js-solita/src/generated/types/Creator.ts b/clients/js-solita/src/generated/types/Creator.ts index 59ef0eb0..971572a4 100644 --- a/clients/js-solita/src/generated/types/Creator.ts +++ b/clients/js-solita/src/generated/types/Creator.ts @@ -5,14 +5,14 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import * as beet from '@metaplex-foundation/beet' +import * as web3 from '@solana/web3.js'; +import * as beetSolana from '@metaplex-foundation/beet-solana'; +import * as beet from '@metaplex-foundation/beet'; export type Creator = { - address: web3.PublicKey - verified: boolean - share: number -} + address: web3.PublicKey; + verified: boolean; + share: number; +}; /** * @category userTypes @@ -24,5 +24,5 @@ export const creatorBeet = new beet.BeetArgsStruct( ['verified', beet.bool], ['share', beet.u8], ], - 'Creator' -) + 'Creator', +); diff --git a/clients/js-solita/src/generated/types/InstructionName.ts b/clients/js-solita/src/generated/types/InstructionName.ts index 237f5409..62701e45 100644 --- a/clients/js-solita/src/generated/types/InstructionName.ts +++ b/clients/js-solita/src/generated/types/InstructionName.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' +import * as beet from '@metaplex-foundation/beet'; /** * @category enums * @category generated @@ -29,12 +29,14 @@ export enum InstructionName { MintToCollectionV1, SetDecompressableState, UpdateMetadata, + UpdateMetadataCollectionNft, } /** * @category userTypes * @category generated */ -export const instructionNameBeet = beet.fixedScalarEnum( +export const instructionNameBeet = beet.fixedScalarEnum(InstructionName) as beet.FixedSizeBeet< + InstructionName, InstructionName -) as beet.FixedSizeBeet +>; diff --git a/clients/js-solita/src/generated/types/LeafSchema.ts b/clients/js-solita/src/generated/types/LeafSchema.ts index dc1dc77f..79d324e4 100644 --- a/clients/js-solita/src/generated/types/LeafSchema.ts +++ b/clients/js-solita/src/generated/types/LeafSchema.ts @@ -5,9 +5,9 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' +import * as web3 from '@solana/web3.js'; +import * as beet from '@metaplex-foundation/beet'; +import * as beetSolana from '@metaplex-foundation/beet-solana'; /** * This type is used to derive the {@link LeafSchema} type as well as the de/serializer. * However don't refer to it in your code but use the {@link LeafSchema} type instead. @@ -19,14 +19,14 @@ import * as beetSolana from '@metaplex-foundation/beet-solana' */ export type LeafSchemaRecord = { V1: { - id: web3.PublicKey - owner: web3.PublicKey - delegate: web3.PublicKey - nonce: beet.bignum - dataHash: number[] /* size: 32 */ - creatorHash: number[] /* size: 32 */ - } -} + id: web3.PublicKey; + owner: web3.PublicKey; + delegate: web3.PublicKey; + nonce: beet.bignum; + dataHash: number[] /* size: 32 */; + creatorHash: number[] /* size: 32 */; + }; +}; /** * Union type respresenting the LeafSchema data enum defined in Rust. @@ -39,11 +39,10 @@ export type LeafSchemaRecord = { * @category enums * @category generated */ -export type LeafSchema = beet.DataEnumKeyAsKind +export type LeafSchema = beet.DataEnumKeyAsKind; -export const isLeafSchemaV1 = ( - x: LeafSchema -): x is LeafSchema & { __kind: 'V1' } => x.__kind === 'V1' +export const isLeafSchemaV1 = (x: LeafSchema): x is LeafSchema & { __kind: 'V1' } => + x.__kind === 'V1'; /** * @category userTypes @@ -61,7 +60,7 @@ export const leafSchemaBeet = beet.dataEnum([ ['dataHash', beet.uniformFixedSizeArray(beet.u8, 32)], ['creatorHash', beet.uniformFixedSizeArray(beet.u8, 32)], ], - 'LeafSchemaRecord["V1"]' + 'LeafSchemaRecord["V1"]', ), ], -]) as beet.FixableBeet; +]) as beet.FixableBeet; diff --git a/clients/js-solita/src/generated/types/MetadataArgs.ts b/clients/js-solita/src/generated/types/MetadataArgs.ts index cf5c41ea..c4bd4731 100644 --- a/clients/js-solita/src/generated/types/MetadataArgs.ts +++ b/clients/js-solita/src/generated/types/MetadataArgs.ts @@ -5,29 +5,26 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import { TokenStandard, tokenStandardBeet } from './TokenStandard' -import { Collection, collectionBeet } from './Collection' -import { Uses, usesBeet } from './Uses' -import { - TokenProgramVersion, - tokenProgramVersionBeet, -} from './TokenProgramVersion' -import { Creator, creatorBeet } from './Creator' +import * as beet from '@metaplex-foundation/beet'; +import { TokenStandard, tokenStandardBeet } from './TokenStandard'; +import { Collection, collectionBeet } from './Collection'; +import { Uses, usesBeet } from './Uses'; +import { TokenProgramVersion, tokenProgramVersionBeet } from './TokenProgramVersion'; +import { Creator, creatorBeet } from './Creator'; export type MetadataArgs = { - name: string - symbol: string - uri: string - sellerFeeBasisPoints: number - primarySaleHappened: boolean - isMutable: boolean - editionNonce: beet.COption - tokenStandard: beet.COption - collection: beet.COption - uses: beet.COption - tokenProgramVersion: TokenProgramVersion - creators: Creator[] -} + name: string; + symbol: string; + uri: string; + sellerFeeBasisPoints: number; + primarySaleHappened: boolean; + isMutable: boolean; + editionNonce: beet.COption; + tokenStandard: beet.COption; + collection: beet.COption; + uses: beet.COption; + tokenProgramVersion: TokenProgramVersion; + creators: Creator[]; +}; /** * @category userTypes @@ -48,5 +45,5 @@ export const metadataArgsBeet = new beet.FixableBeetArgsStruct( ['tokenProgramVersion', tokenProgramVersionBeet], ['creators', beet.array(creatorBeet)], ], - 'MetadataArgs' -) + 'MetadataArgs', +); diff --git a/clients/js-solita/src/generated/types/TokenProgramVersion.ts b/clients/js-solita/src/generated/types/TokenProgramVersion.ts index 3da19eb2..60effbe5 100644 --- a/clients/js-solita/src/generated/types/TokenProgramVersion.ts +++ b/clients/js-solita/src/generated/types/TokenProgramVersion.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' +import * as beet from '@metaplex-foundation/beet'; /** * @category enums * @category generated @@ -20,5 +20,5 @@ export enum TokenProgramVersion { * @category generated */ export const tokenProgramVersionBeet = beet.fixedScalarEnum( - TokenProgramVersion -) as beet.FixedSizeBeet + TokenProgramVersion, +) as beet.FixedSizeBeet; diff --git a/clients/js-solita/src/generated/types/TokenStandard.ts b/clients/js-solita/src/generated/types/TokenStandard.ts index 0dddfc94..dc449df0 100644 --- a/clients/js-solita/src/generated/types/TokenStandard.ts +++ b/clients/js-solita/src/generated/types/TokenStandard.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' +import * as beet from '@metaplex-foundation/beet'; /** * @category enums * @category generated @@ -21,6 +21,7 @@ export enum TokenStandard { * @category userTypes * @category generated */ -export const tokenStandardBeet = beet.fixedScalarEnum( +export const tokenStandardBeet = beet.fixedScalarEnum(TokenStandard) as beet.FixedSizeBeet< + TokenStandard, TokenStandard -) as beet.FixedSizeBeet +>; diff --git a/clients/js-solita/src/generated/types/UseMethod.ts b/clients/js-solita/src/generated/types/UseMethod.ts index 3c26540c..dfdec71a 100644 --- a/clients/js-solita/src/generated/types/UseMethod.ts +++ b/clients/js-solita/src/generated/types/UseMethod.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' +import * as beet from '@metaplex-foundation/beet'; /** * @category enums * @category generated @@ -20,6 +20,7 @@ export enum UseMethod { * @category userTypes * @category generated */ -export const useMethodBeet = beet.fixedScalarEnum( +export const useMethodBeet = beet.fixedScalarEnum(UseMethod) as beet.FixedSizeBeet< + UseMethod, UseMethod -) as beet.FixedSizeBeet +>; diff --git a/clients/js-solita/src/generated/types/Uses.ts b/clients/js-solita/src/generated/types/Uses.ts index ee3dc2a2..1381ee33 100644 --- a/clients/js-solita/src/generated/types/Uses.ts +++ b/clients/js-solita/src/generated/types/Uses.ts @@ -5,13 +5,13 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' -import { UseMethod, useMethodBeet } from './UseMethod' +import * as beet from '@metaplex-foundation/beet'; +import { UseMethod, useMethodBeet } from './UseMethod'; export type Uses = { - useMethod: UseMethod - remaining: beet.bignum - total: beet.bignum -} + useMethod: UseMethod; + remaining: beet.bignum; + total: beet.bignum; +}; /** * @category userTypes @@ -23,5 +23,5 @@ export const usesBeet = new beet.BeetArgsStruct( ['remaining', beet.u64], ['total', beet.u64], ], - 'Uses' -) + 'Uses', +); diff --git a/clients/js-solita/src/generated/types/Version.ts b/clients/js-solita/src/generated/types/Version.ts index 3461176c..7855039e 100644 --- a/clients/js-solita/src/generated/types/Version.ts +++ b/clients/js-solita/src/generated/types/Version.ts @@ -5,7 +5,7 @@ * See: https://github.com/metaplex-foundation/solita */ -import * as beet from '@metaplex-foundation/beet' +import * as beet from '@metaplex-foundation/beet'; /** * @category enums * @category generated @@ -18,7 +18,4 @@ export enum Version { * @category userTypes * @category generated */ -export const versionBeet = beet.fixedScalarEnum(Version) as beet.FixedSizeBeet< - Version, - Version -> +export const versionBeet = beet.fixedScalarEnum(Version) as beet.FixedSizeBeet; diff --git a/idls/bubblegum.json b/idls/bubblegum.json index 7e8f6af3..f28fd5f8 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1095,16 +1095,7 @@ { "name": "treeAuthority", "isMut": false, - "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "merkle_tree" - } - ] - } + "isSigner": false }, { "name": "treeDelegate", @@ -1238,16 +1229,7 @@ { "name": "treeAuthority", "isMut": false, - "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "account", - "type": "publicKey", - "path": "merkle_tree" - } - ] - } + "isSigner": false }, { "name": "treeDelegate", @@ -2125,6 +2107,9 @@ }, { "name": "UpdateMetadata" + }, + { + "name": "UpdateMetadataCollectionNft" } ] } @@ -2323,11 +2308,6 @@ }, { "code": 6038, - "name": "MissingCollectionAuthoritySignature", - "msg": "Missing Collection Authority Signature" - }, - { - "code": 6039, "name": "NFTLinkedToCollection", "msg": "NFT linked to collection" } diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 36a6a119..2fbcbe70 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -1031,9 +1031,9 @@ fn assert_collection_authority_signed_if_required<'info>( // Assert that the correct Collection Authority was provided using token-metadata assert_has_collection_authority( - &collection_authority, &collection_metadata, collection_mint.key, + collection_authority.key, collection_authority_record.as_ref(), )?; From 4855ed4a67ad5253ff96c3ce20d56fc2315e0907 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 16:17:16 -0400 Subject: [PATCH 08/17] small fixes --- clients/js-solita/.prettierignore | 2 + clients/js-solita/package.json | 2 +- .../js-solita/src/generated/errors/index.ts | 12 ++--- .../updateMetadataCollectionNft.ts | 4 +- clients/js-solita/src/mpl-bubblegum.ts | 2 +- idls/bubblegum.json | 26 +++------ programs/bubblegum/program/src/error.rs | 6 +-- programs/bubblegum/program/src/lib.rs | 53 +++++++++---------- 8 files changed, 47 insertions(+), 60 deletions(-) create mode 100644 clients/js-solita/.prettierignore diff --git a/clients/js-solita/.prettierignore b/clients/js-solita/.prettierignore new file mode 100644 index 00000000..de4d1f00 --- /dev/null +++ b/clients/js-solita/.prettierignore @@ -0,0 +1,2 @@ +dist +node_modules diff --git a/clients/js-solita/package.json b/clients/js-solita/package.json index ba4b4266..17d73778 100644 --- a/clients/js-solita/package.json +++ b/clients/js-solita/package.json @@ -13,7 +13,7 @@ "postpublish": "git push origin && git push origin --tags", "build:docs": "typedoc", "build": "rimraf dist && tsc -p tsconfig.json", - "start-validator": "solana-test-validator -ud --reset -c cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK -c 4VTQredsAmr1yzRJugLV6Mt6eu6XMeCwdkZ73wwVMWHv -c noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV -c 3RHkdjCwWyK2firrwFQGvXCxbUpBky1GTmb9EDK9hUnX -c metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s -c PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT -c TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA -c ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL --bpf-program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY ../../programs/.bin/mpl_bubblegum.so", + "start-validator": "solana-test-validator -ud --quiet --reset -c cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK -c 4VTQredsAmr1yzRJugLV6Mt6eu6XMeCwdkZ73wwVMWHv -c noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV -c 3RHkdjCwWyK2firrwFQGvXCxbUpBky1GTmb9EDK9hUnX -c metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s -c PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT -c TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA -c ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL --bpf-program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY ../../programs/.bin/mpl_bubblegum.so", "run-tests": "jest tests --detectOpenHandles", "test": "start-server-and-test start-validator http://localhost:8899/health run-tests", "api:gen": "DEBUG='(solita|rustbin):(info|error)' solita", diff --git a/clients/js-solita/src/generated/errors/index.ts b/clients/js-solita/src/generated/errors/index.ts index 1aadc4ff..c0fb8638 100644 --- a/clients/js-solita/src/generated/errors/index.ts +++ b/clients/js-solita/src/generated/errors/index.ts @@ -719,7 +719,7 @@ createErrorFromCodeLookup.set(0x1791, () => new DecompressionDisabledError()); createErrorFromNameLookup.set('DecompressionDisabled', () => new DecompressionDisabledError()); /** - * MetadataImmutable: 'Metadata Not Mutable' + * MetadataImmutable: 'Metadata not mutable' * * @category Errors * @category generated @@ -728,7 +728,7 @@ export class MetadataImmutableError extends Error { readonly code: number = 0x1792; readonly name: string = 'MetadataImmutable'; constructor() { - super('Metadata Not Mutable'); + super('Metadata not mutable'); if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, MetadataImmutableError); } @@ -759,7 +759,7 @@ createErrorFromCodeLookup.set(0x1793, () => new CollectionMismatchError()); createErrorFromNameLookup.set('CollectionMismatch', () => new CollectionMismatchError()); /** - * MetadataArgsAmbiguous: 'MetadataArgs Ambiguous' + * MetadataArgsAmbiguous: 'MetadataArgs ambiguous' * * @category Errors * @category generated @@ -768,7 +768,7 @@ export class MetadataArgsAmbiguousError extends Error { readonly code: number = 0x1794; readonly name: string = 'MetadataArgsAmbiguous'; constructor() { - super('MetadataArgs Ambiguous'); + super('MetadataArgs ambiguous'); if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, MetadataArgsAmbiguousError); } @@ -779,7 +779,7 @@ createErrorFromCodeLookup.set(0x1794, () => new MetadataArgsAmbiguousError()); createErrorFromNameLookup.set('MetadataArgsAmbiguous', () => new MetadataArgsAmbiguousError()); /** - * MetadataArgsMissing: 'MetadataArgs Missing' + * MetadataArgsMissing: 'MetadataArgs missing' * * @category Errors * @category generated @@ -788,7 +788,7 @@ export class MetadataArgsMissingError extends Error { readonly code: number = 0x1795; readonly name: string = 'MetadataArgsMissing'; constructor() { - super('MetadataArgs Missing'); + super('MetadataArgs missing'); if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, MetadataArgsMissingError); } diff --git a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts index 80e9f13b..1794b879 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts @@ -60,7 +60,7 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< * @property [] oldMetadataAcct * @property [] treeAuthority * @property [**signer**] treeDelegate - * @property [] collectionAuthority + * @property [**signer**] collectionAuthority * @property [] collectionMint * @property [] collectionMetadata * @property [] collectionAuthorityRecordPda @@ -136,7 +136,7 @@ export function createUpdateMetadataCollectionNftInstruction( { pubkey: accounts.collectionAuthority, isWritable: false, - isSigner: false, + isSigner: true, }, { pubkey: accounts.collectionMint, diff --git a/clients/js-solita/src/mpl-bubblegum.ts b/clients/js-solita/src/mpl-bubblegum.ts index 503bf092..a420d988 100644 --- a/clients/js-solita/src/mpl-bubblegum.ts +++ b/clients/js-solita/src/mpl-bubblegum.ts @@ -30,7 +30,7 @@ export function computeCreatorHash(creators: Creator[]) { Buffer.from([creator.verified ? 1 : 0]), Buffer.from([creator.share]), ]); - }) + }), ); return Buffer.from(keccak_256.digest(bufferOfCreatorData)); } diff --git a/idls/bubblegum.json b/idls/bubblegum.json index f28fd5f8..ab98e54e 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1239,35 +1239,23 @@ { "name": "collectionAuthority", "isMut": false, - "isSigner": false, - "docs": [ - "This account is only required if the NFT is part of a collection" - ] + "isSigner": true }, { "name": "collectionMint", "isMut": false, - "isSigner": false, - "docs": [ - "This account is only required if the NFT is part of a collection" - ] + "isSigner": false }, { "name": "collectionMetadata", "isMut": false, - "isSigner": false, - "docs": [ - "This account is only required if the NFT is part of a collection" - ] + "isSigner": false }, { "name": "collectionAuthorityRecordPda", "isMut": false, "isSigner": false, - "isOptional": true, - "docs": [ - "This account is only required if the NFT is part of a collection" - ] + "isOptional": true }, { "name": "leafOwner", @@ -2289,7 +2277,7 @@ { "code": 6034, "name": "MetadataImmutable", - "msg": "Metadata Not Mutable" + "msg": "Metadata not mutable" }, { "code": 6035, @@ -2299,12 +2287,12 @@ { "code": 6036, "name": "MetadataArgsAmbiguous", - "msg": "MetadataArgs Ambiguous" + "msg": "MetadataArgs ambiguous" }, { "code": 6037, "name": "MetadataArgsMissing", - "msg": "MetadataArgs Missing" + "msg": "MetadataArgs missing" }, { "code": 6038, diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index bd135232..20bf17f3 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -72,13 +72,13 @@ pub enum BubblegumError { UnknownExternalError, #[msg("Decompression is disabled for this tree.")] DecompressionDisabled, - #[msg("Metadata Not Mutable")] + #[msg("Metadata not mutable")] MetadataImmutable, #[msg("Collection mismatch")] CollectionMismatch, - #[msg("MetadataArgs Ambiguous")] + #[msg("MetadataArgs ambiguous")] MetadataArgsAmbiguous, - #[msg("MetadataArgs Missing")] + #[msg("MetadataArgs missing")] MetadataArgsMissing, #[msg("NFT linked to collection")] NFTLinkedToCollection, diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 2fbcbe70..a886a4b1 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -5,7 +5,7 @@ use crate::{ error::{metadata_error_into_bubblegum, BubblegumError}, state::{ leaf_schema::LeafSchema, - metaplex_adapter::{self, Creator, MetadataArgs, TokenProgramVersion, Collection}, + metaplex_adapter::{self, Collection, Creator, MetadataArgs, TokenProgramVersion}, metaplex_anchor::{MasterEdition, MplTokenMetadata, TokenMetadata}, DecompressableState, TreeConfig, Voucher, ASSET_PREFIX, COLLECTION_CPI_PREFIX, TREE_AUTHORITY_SIZE, VOUCHER_PREFIX, VOUCHER_SIZE, @@ -289,15 +289,10 @@ pub struct UpdateMetadataCollectionNFT<'info> { /// CHECK: This account is neither written to nor read from. pub tree_authority: Account<'info, TreeConfig>, pub tree_delegate: Signer<'info>, - /// This account is only required if the NFT is part of a collection - /// CHECK: This account is checked in the instruction - pub collection_authority: UncheckedAccount<'info>, - /// This account is only required if the NFT is part of a collection + pub collection_authority: Signer<'info>, /// CHECK: This account is checked in the instruction pub collection_mint: UncheckedAccount<'info>, - /// This account is only required if the NFT is part of a collection pub collection_metadata: Box>, - /// This account is only required if the NFT is part of a collection /// CHECK: This account is checked in the instruction pub collection_authority_record_pda: Option>, /// CHECK: This account is checked in the instruction @@ -539,7 +534,7 @@ pub enum InstructionName { MintToCollectionV1, SetDecompressableState, UpdateMetadata, - UpdateMetadataCollectionNft + UpdateMetadataCollectionNft, } pub fn get_instruction_type(full_bytes: &[u8]) -> InstructionName { @@ -956,15 +951,16 @@ fn process_collection_verification<'info>( fn assert_signed_by_tree_delegate<'info>( tree_config: &TreeConfig, - incoming_signer: &Signer<'info> + incoming_signer: &Signer<'info>, ) -> Result<()> { if !tree_config.is_public { require!( - incoming_signer.key() == tree_config.tree_creator || incoming_signer.key() == tree_config.tree_delegate, + incoming_signer.key() == tree_config.tree_creator + || incoming_signer.key() == tree_config.tree_delegate, BubblegumError::TreeAuthorityIncorrect, ); } - return Ok(()) + return Ok(()); } fn fetch_old_metadata_args<'info>( @@ -993,19 +989,15 @@ fn fetch_old_metadata_args<'info>( Ok(old_metadata) } -fn assert_collection_authority_signed_if_required<'info>( +fn assert_collection_authority_signed<'info>( collection: &Collection, collection_authority: &AccountInfo<'info>, collection_authority_record_pda: &Option>, collection_mint: &AccountInfo<'info>, collection_metadata_account_info: &AccountInfo, collection_metadata: &TokenMetadata, - token_metadata_program: &Program<'info, MplTokenMetadata> + token_metadata_program: &Program<'info, MplTokenMetadata>, ) -> Result<()> { - // NFTs linked to unverified collections do not require collection authority signatures - if !collection.verified { - return Ok(()) - } // Mint account must match Collection mint require!( collection_mint.key() == collection.key, @@ -1024,9 +1016,7 @@ fn assert_collection_authority_signed_if_required<'info>( let collection_authority_record = match &collection_authority_record_pda { None => None, - Some(authority_record_pda) => { - Some(authority_record_pda.to_account_info()) - } + Some(authority_record_pda) => Some(authority_record_pda.to_account_info()), }; // Assert that the correct Collection Authority was provided using token-metadata @@ -1036,7 +1026,7 @@ fn assert_collection_authority_signed_if_required<'info>( collection_authority.key, collection_authority_record.as_ref(), )?; - + Ok(()) } @@ -1624,8 +1614,12 @@ pub mod bubblegum { // Determine how the user opted to pass in the old MetadataArgs let old_metadata = fetch_old_metadata_args(old_metadata, &ctx.accounts.old_metadata_acct)?; - // NFTs which are linked to collections cannot be updated through this instruction - require!(old_metadata.collection.is_none(), BubblegumError::NFTLinkedToCollection); + // NFTs which are linked to verified collections cannot be updated through this instruction + require!( + old_metadata.collection.is_none() + || !old_metadata.collection.as_ref().unwrap().verified, + BubblegumError::NFTLinkedToCollection + ); process_update_metadata( &ctx.accounts.merkle_tree.to_account_info(), @@ -1646,7 +1640,8 @@ pub mod bubblegum { new_primary_sale_happened, new_is_mutable, nonce, - index) + index, + ) } pub fn update_metadata_collection_nft<'info, 'a>( @@ -1669,16 +1664,17 @@ pub mod bubblegum { let old_metadata = fetch_old_metadata_args(old_metadata, &ctx.accounts.old_metadata_acct)?; // NFTs updated through this instruction must be linked to a collection, - // and the collection authority for that collection must sign + // so a collection authority for that collection must sign let collection = old_metadata.collection.as_ref().unwrap(); - assert_collection_authority_signed_if_required( + assert_collection_authority_signed( &collection, &ctx.accounts.collection_authority.to_account_info(), &ctx.accounts.collection_authority_record_pda, &ctx.accounts.collection_mint, &ctx.accounts.collection_metadata.to_account_info(), &ctx.accounts.collection_metadata, - &ctx.accounts.token_metadata_program)?; + &ctx.accounts.token_metadata_program, + )?; process_update_metadata( &ctx.accounts.merkle_tree.to_account_info(), @@ -1699,7 +1695,8 @@ pub mod bubblegum { new_primary_sale_happened, new_is_mutable, nonce, - index) + index, + ) } pub fn redeem<'info>( From 3bd2532503a17bc2ee68f93e1d318987c66827e5 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Tue, 29 Aug 2023 16:21:18 -0400 Subject: [PATCH 09/17] nit --- clients/js-solita/tests/main.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index 8d54447c..8807c570 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -267,8 +267,8 @@ describe('Bubblegum tests', () => { }); it('Can verify existence of a compressed NFT', async () => { - const updateSuccess = await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, originalCompressedNFT); - assert(updateSuccess.success === true, "Failed to verify leaf"); + const result = await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, originalCompressedNFT); + assert(result.success, "Failed to verify leaf"); }); it('Non-collection NFT Update', async () => { From a938436f620a8bbacc48e33cca97d26c2f996370 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Sun, 3 Sep 2023 13:24:18 -0400 Subject: [PATCH 10/17] address code review, without additional test --- clients/js-solita/package.json | 2 +- .../js-solita/src/generated/errors/index.ts | 46 +++++++++ .../generated/instructions/updateMetadata.ts | 8 +- .../updateMetadataCollectionNft.ts | 8 +- clients/js-solita/tests/main.test.ts | 12 +-- idls/bubblegum.json | 42 +++++---- programs/bubblegum/program/src/error.rs | 4 + programs/bubblegum/program/src/lib.rs | 93 ++++++++++--------- 8 files changed, 140 insertions(+), 75 deletions(-) diff --git a/clients/js-solita/package.json b/clients/js-solita/package.json index 17d73778..6c7cc9b6 100644 --- a/clients/js-solita/package.json +++ b/clients/js-solita/package.json @@ -13,7 +13,7 @@ "postpublish": "git push origin && git push origin --tags", "build:docs": "typedoc", "build": "rimraf dist && tsc -p tsconfig.json", - "start-validator": "solana-test-validator -ud --quiet --reset -c cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK -c 4VTQredsAmr1yzRJugLV6Mt6eu6XMeCwdkZ73wwVMWHv -c noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV -c 3RHkdjCwWyK2firrwFQGvXCxbUpBky1GTmb9EDK9hUnX -c metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s -c PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT -c TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA -c ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL --bpf-program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY ../../programs/.bin/mpl_bubblegum.so", + "start-validator": "solana-test-validator -ud --quiet --reset -c cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK -c 4VTQredsAmr1yzRJugLV6Mt6eu6XMeCwdkZ73wwVMWHv -c noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV -c 3RHkdjCwWyK2firrwFQGvXCxbUpBky1GTmb9EDK9hUnX -c metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s -c PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT --bpf-program BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY ../../programs/.bin/mpl_bubblegum.so", "run-tests": "jest tests --detectOpenHandles", "test": "start-server-and-test start-validator http://localhost:8899/health run-tests", "api:gen": "DEBUG='(solita|rustbin):(info|error)' solita", diff --git a/clients/js-solita/src/generated/errors/index.ts b/clients/js-solita/src/generated/errors/index.ts index c0fb8638..3f9783cf 100644 --- a/clients/js-solita/src/generated/errors/index.ts +++ b/clients/js-solita/src/generated/errors/index.ts @@ -818,6 +818,52 @@ export class NFTLinkedToCollectionError extends Error { createErrorFromCodeLookup.set(0x1796, () => new NFTLinkedToCollectionError()); createErrorFromNameLookup.set('NFTLinkedToCollection', () => new NFTLinkedToCollectionError()); +/** + * NFTNotLinkedToVerifiedCollection: 'NFT not linked to verified collection' + * + * @category Errors + * @category generated + */ +export class NFTNotLinkedToVerifiedCollectionError extends Error { + readonly code: number = 0x1797; + readonly name: string = 'NFTNotLinkedToVerifiedCollection'; + constructor() { + super('NFT not linked to verified collection'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, NFTNotLinkedToVerifiedCollectionError); + } + } +} + +createErrorFromCodeLookup.set(0x1797, () => new NFTNotLinkedToVerifiedCollectionError()); +createErrorFromNameLookup.set( + 'NFTNotLinkedToVerifiedCollection', + () => new NFTNotLinkedToVerifiedCollectionError(), +); + +/** + * PrimarySaleCanOnlyBeFlippedToTrue: 'Can only update primary sale to true' + * + * @category Errors + * @category generated + */ +export class PrimarySaleCanOnlyBeFlippedToTrueError extends Error { + readonly code: number = 0x1798; + readonly name: string = 'PrimarySaleCanOnlyBeFlippedToTrue'; + constructor() { + super('Can only update primary sale to true'); + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, PrimarySaleCanOnlyBeFlippedToTrueError); + } + } +} + +createErrorFromCodeLookup.set(0x1798, () => new PrimarySaleCanOnlyBeFlippedToTrueError()); +createErrorFromNameLookup.set( + 'PrimarySaleCanOnlyBeFlippedToTrue', + () => new PrimarySaleCanOnlyBeFlippedToTrueError(), +); + /** * Attempts to resolve a custom program error from the provided error code. * @category Errors diff --git a/clients/js-solita/src/generated/instructions/updateMetadata.ts b/clients/js-solita/src/generated/instructions/updateMetadata.ts index 9be1bf7a..a584a692 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadata.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadata.ts @@ -17,6 +17,8 @@ import { Creator, creatorBeet } from '../types/Creator'; */ export type UpdateMetadataInstructionArgs = { root: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; oldMetadata: beet.COption; newName: beet.COption; newSymbol: beet.COption; @@ -25,8 +27,6 @@ export type UpdateMetadataInstructionArgs = { newSellerFeeBasisPoints: beet.COption; newPrimarySaleHappened: beet.COption; newIsMutable: beet.COption; - nonce: beet.bignum; - index: number; }; /** * @category Instructions @@ -41,6 +41,8 @@ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['root', beet.uniformFixedSizeArray(beet.u8, 32)], + ['nonce', beet.u64], + ['index', beet.u32], ['oldMetadata', beet.coption(metadataArgsBeet)], ['newName', beet.coption(beet.utf8String)], ['newSymbol', beet.coption(beet.utf8String)], @@ -49,8 +51,6 @@ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< ['newSellerFeeBasisPoints', beet.coption(beet.u16)], ['newPrimarySaleHappened', beet.coption(beet.bool)], ['newIsMutable', beet.coption(beet.bool)], - ['nonce', beet.u64], - ['index', beet.u32], ], 'UpdateMetadataInstructionArgs', ); diff --git a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts index 1794b879..f0b41179 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts @@ -17,6 +17,8 @@ import { Creator, creatorBeet } from '../types/Creator'; */ export type UpdateMetadataCollectionNftInstructionArgs = { root: number[] /* size: 32 */; + nonce: beet.bignum; + index: number; oldMetadata: beet.COption; newName: beet.COption; newSymbol: beet.COption; @@ -25,8 +27,6 @@ export type UpdateMetadataCollectionNftInstructionArgs = { newSellerFeeBasisPoints: beet.COption; newPrimarySaleHappened: beet.COption; newIsMutable: beet.COption; - nonce: beet.bignum; - index: number; }; /** * @category Instructions @@ -41,6 +41,8 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< [ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['root', beet.uniformFixedSizeArray(beet.u8, 32)], + ['nonce', beet.u64], + ['index', beet.u32], ['oldMetadata', beet.coption(metadataArgsBeet)], ['newName', beet.coption(beet.utf8String)], ['newSymbol', beet.coption(beet.utf8String)], @@ -49,8 +51,6 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< ['newSellerFeeBasisPoints', beet.coption(beet.u16)], ['newPrimarySaleHappened', beet.coption(beet.bool)], ['newIsMutable', beet.coption(beet.bool)], - ['nonce', beet.u64], - ['index', beet.u32], ], 'UpdateMetadataCollectionNftInstructionArgs', ); diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index 8807c570..60c2b104 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -293,6 +293,8 @@ describe('Bubblegum tests', () => { }, { root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 0, + index: 0, oldMetadata: originalCompressedNFT, newName: 'NewName', newSymbol: 'NewSymbol', @@ -301,8 +303,6 @@ describe('Bubblegum tests', () => { newSellerFeeBasisPoints: null, newPrimarySaleHappened: null, newIsMutable: null, - nonce: 0, - index: 0 }, ); @@ -359,7 +359,8 @@ describe('Bubblegum tests', () => { const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); - // Update the NFT in the collection + // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree + // Thus we must alter the MetadataArgs object we expect to exist in the leaf before the update to match const oldMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( { @@ -380,7 +381,8 @@ describe('Bubblegum tests', () => { }, { root: Array.from(merkleAccount.getCurrentRoot()), - // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree + nonce: 1, + index: 1, oldMetadata: oldMetadataArgs, newName: 'NewName', newSymbol: 'NewSymbol', @@ -389,8 +391,6 @@ describe('Bubblegum tests', () => { newSellerFeeBasisPoints: null, newPrimarySaleHappened: null, newIsMutable: null, - nonce: 1, - index: 1 }, ); diff --git a/idls/bubblegum.json b/idls/bubblegum.json index ab98e54e..7a9658a1 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1153,6 +1153,14 @@ ] } }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "index", + "type": "u32" + }, { "name": "oldMetadata", "type": { @@ -1206,14 +1214,6 @@ "type": { "option": "bool" } - }, - { - "name": "nonce", - "type": "u64" - }, - { - "name": "index", - "type": "u32" } ] }, @@ -1308,6 +1308,14 @@ ] } }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "index", + "type": "u32" + }, { "name": "oldMetadata", "type": { @@ -1361,14 +1369,6 @@ "type": { "option": "bool" } - }, - { - "name": "nonce", - "type": "u64" - }, - { - "name": "index", - "type": "u32" } ] }, @@ -2298,6 +2298,16 @@ "code": 6038, "name": "NFTLinkedToCollection", "msg": "NFT linked to collection" + }, + { + "code": 6039, + "name": "NFTNotLinkedToVerifiedCollection", + "msg": "NFT not linked to verified collection" + }, + { + "code": 6040, + "name": "PrimarySaleCanOnlyBeFlippedToTrue", + "msg": "Can only update primary sale to true" } ], "metadata": { diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index 20bf17f3..d3d2208f 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -82,6 +82,10 @@ pub enum BubblegumError { MetadataArgsMissing, #[msg("NFT linked to collection")] NFTLinkedToCollection, + #[msg("NFT not linked to verified collection")] + NFTNotLinkedToVerifiedCollection, + #[msg("Can only update primary sale to true")] + PrimarySaleCanOnlyBeFlippedToTrue, } // Converts certain Token Metadata errors into Bubblegum equivalents diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index a886a4b1..b7fc6a12 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -949,23 +949,21 @@ fn process_collection_verification<'info>( ) } -fn assert_signed_by_tree_delegate<'info>( +fn assert_signed_by_tree_delegate( tree_config: &TreeConfig, - incoming_signer: &Signer<'info>, + incoming_signer: &Signer, ) -> Result<()> { - if !tree_config.is_public { - require!( - incoming_signer.key() == tree_config.tree_creator - || incoming_signer.key() == tree_config.tree_delegate, - BubblegumError::TreeAuthorityIncorrect, - ); - } - return Ok(()); + require!( + incoming_signer.key() == tree_config.tree_creator + || incoming_signer.key() == tree_config.tree_delegate, + BubblegumError::TreeAuthorityIncorrect, + ); + Ok(()) } -fn fetch_old_metadata_args<'info>( +fn fetch_old_metadata_args( old_metadata_arg: Option, - old_metadata_acct: &Option>, + old_metadata_acct: &Option, ) -> Result { let old_metadata = match old_metadata_arg { Some(metadata) => { @@ -976,20 +974,17 @@ fn fetch_old_metadata_args<'info>( metadata } None => { - require!( - old_metadata_acct.is_some(), - BubblegumError::MetadataArgsMissing - ); - let old_metadata_account = old_metadata_acct.as_ref().unwrap(); - let old_metadata_data = old_metadata_account.try_borrow_mut_data()?; - let mut old_metadata_data_slice = old_metadata_data.as_ref(); - MetadataArgs::deserialize(&mut old_metadata_data_slice)? + let old_metadata_account = old_metadata_acct + .as_ref() + .ok_or(BubblegumError::MetadataArgsMissing)?; + let old_metadata_data = old_metadata_account.try_borrow_data()?; + MetadataArgs::deserialize(&mut old_metadata_data.as_ref())? } }; Ok(old_metadata) } -fn assert_collection_authority_signed<'info>( +fn assert_authority_matches_collection<'info>( collection: &Collection, collection_authority: &AccountInfo<'info>, collection_authority_record_pda: &Option>, @@ -1003,6 +998,11 @@ fn assert_collection_authority_signed<'info>( collection_mint.key() == collection.key, BubblegumError::CollectionMismatch ); + // Metadata mint must match Collection mint + require!( + collection_metadata.mint == collection.key, + BubblegumError::CollectionMismatch + ); // Verify correct account ownerships. require!( *collection_metadata_account_info.owner == token_metadata_program.key(), @@ -1014,14 +1014,13 @@ fn assert_collection_authority_signed<'info>( BubblegumError::IncorrectOwner ); - let collection_authority_record = match &collection_authority_record_pda { - None => None, - Some(authority_record_pda) => Some(authority_record_pda.to_account_info()), - }; + let collection_authority_record = collection_authority_record_pda + .as_ref() + .map(|authority_record_pda| authority_record_pda.to_account_info()); // Assert that the correct Collection Authority was provided using token-metadata assert_has_collection_authority( - &collection_metadata, + collection_metadata, collection_mint.key, collection_authority.key, collection_authority_record.as_ref(), @@ -1030,7 +1029,7 @@ fn assert_collection_authority_signed<'info>( Ok(()) } -fn process_update_metadata<'info, 'a>( +fn process_update_metadata<'info>( merkle_tree: &AccountInfo<'info>, owner: &AccountInfo<'info>, delegate: &AccountInfo<'info>, @@ -1038,7 +1037,7 @@ fn process_update_metadata<'info, 'a>( tree_authority: &AccountInfo<'info>, tree_authority_bump: u8, log_wrapper: &Program<'info, Noop>, - remaining_accounts: &'a [AccountInfo<'info>], + remaining_accounts: &[AccountInfo<'info>], root: [u8; 32], old_metadata: MetadataArgs, new_name: Option, @@ -1088,9 +1087,12 @@ fn process_update_metadata<'info, 'a>( new_metadata.seller_fee_basis_points = seller_fee_basis_points }; if let Some(primary_sale_happened) = new_primary_sale_happened { - if !new_metadata.primary_sale_happened { - new_metadata.primary_sale_happened = primary_sale_happened - } + // a new value of primary_sale_happened should only be specified if primary_sale_happened was false in the original metadata + require!( + !new_metadata.primary_sale_happened, + BubblegumError::PrimarySaleCanOnlyBeFlippedToTrue + ); + new_metadata.primary_sale_happened = primary_sale_happened; }; if let Some(is_mutable) = new_is_mutable { new_metadata.is_mutable = is_mutable; @@ -1595,9 +1597,11 @@ pub mod bubblegum { ) } - pub fn update_metadata<'info, 'a>( - ctx: Context<'_, '_, 'a, 'info, UpdateMetadata<'info>>, + pub fn update_metadata<'info>( + ctx: Context<'_, '_, '_, 'info, UpdateMetadata<'info>>, root: [u8; 32], + nonce: u64, + index: u32, old_metadata: Option, new_name: Option, new_symbol: Option, @@ -1606,8 +1610,6 @@ pub mod bubblegum { new_seller_fee_basis_points: Option, new_primary_sale_happened: Option, new_is_mutable: Option, - nonce: u64, - index: u32, ) -> Result<()> { assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; @@ -1629,7 +1631,7 @@ pub mod bubblegum { &ctx.accounts.tree_authority.to_account_info(), *ctx.bumps.get("tree_authority").unwrap(), &ctx.accounts.log_wrapper, - &ctx.remaining_accounts, + ctx.remaining_accounts, root, old_metadata, new_name, @@ -1644,9 +1646,11 @@ pub mod bubblegum { ) } - pub fn update_metadata_collection_nft<'info, 'a>( - ctx: Context<'_, '_, 'a, 'info, UpdateMetadataCollectionNFT<'info>>, + pub fn update_metadata_collection_nft<'info>( + ctx: Context<'_, '_, '_, 'info, UpdateMetadataCollectionNFT<'info>>, root: [u8; 32], + nonce: u64, + index: u32, old_metadata: Option, new_name: Option, new_symbol: Option, @@ -1655,8 +1659,6 @@ pub mod bubblegum { new_seller_fee_basis_points: Option, new_primary_sale_happened: Option, new_is_mutable: Option, - nonce: u64, - index: u32, ) -> Result<()> { assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; @@ -1665,9 +1667,12 @@ pub mod bubblegum { // NFTs updated through this instruction must be linked to a collection, // so a collection authority for that collection must sign - let collection = old_metadata.collection.as_ref().unwrap(); - assert_collection_authority_signed( - &collection, + let collection = old_metadata + .collection + .as_ref() + .ok_or(BubblegumError::NFTNotLinkedToVerifiedCollection)?; + assert_authority_matches_collection( + collection, &ctx.accounts.collection_authority.to_account_info(), &ctx.accounts.collection_authority_record_pda, &ctx.accounts.collection_mint, @@ -1684,7 +1689,7 @@ pub mod bubblegum { &ctx.accounts.tree_authority.to_account_info(), *ctx.bumps.get("tree_authority").unwrap(), &ctx.accounts.log_wrapper, - &ctx.remaining_accounts, + ctx.remaining_accounts, root, old_metadata, new_name, From 950aa744cb8631e4a7d90b3b144ac6bfb8ad9010 Mon Sep 17 00:00:00 2001 From: Sam Orend Date: Sun, 3 Sep 2023 14:15:14 -0400 Subject: [PATCH 11/17] added creator verification test --- clients/js-solita/tests/main.test.ts | 299 +++++++++++++++----------- programs/bubblegum/program/src/lib.rs | 1 + 2 files changed, 174 insertions(+), 126 deletions(-) diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index 60c2b104..3786ac44 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -271,142 +271,189 @@ describe('Bubblegum tests', () => { assert(result.success, "Failed to verify leaf"); }); - it('Non-collection NFT Update', async () => { - const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); - const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); - const [treeAuthority] = PublicKey.findProgramAddressSync( - [merkleTree.toBuffer()], - BUBBLEGUM_PROGRAM_ID, - ); - const updateMetadataIx = createUpdateMetadataInstruction( - { - oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + describe("Update metadata", () => { + let treeAuthority: PublicKey; + beforeEach(async () => { + [treeAuthority] = PublicKey.findProgramAddressSync( + [merkleTree.toBuffer()], + BUBBLEGUM_PROGRAM_ID, + ); + }); + describe("Not linked to collection", () => { + let merkleAccount: ConcurrentMerkleTreeAccount; + beforeEach(async () => { + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); + }); + it('Simple update', async () => { + const updateMetadataIx = createUpdateMetadataInstruction( + { + oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 0, + index: 0, + oldMetadata: originalCompressedNFT, + newName: 'NewName', + newSymbol: 'NewSymbol', + newUri: 'https://foobar.com', + newCreators: null, + newSellerFeeBasisPoints: null, + newPrimarySaleHappened: null, + newIsMutable: null, + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Update metadata tx success:", updateMetadataTxId) + + const newMetadataArgs: MetadataArgs = { ...originalCompressedNFT, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; + + // We should now be able to verify the new leaf with the metadata replaced + await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, newMetadataArgs); + }); + it('Cannot verify currently un-verified creator', async () => { + const updateMetadataIx = createUpdateMetadataInstruction( + { + oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 0, + index: 0, + oldMetadata: originalCompressedNFT, + newName: 'NewName', + newSymbol: 'NewSymbol', + newUri: 'https://foobar.com', + // Attempt to verify all creators, even though some are not verified + newCreators: creators.map(c => ({ ...c, verified: true })), + newSellerFeeBasisPoints: null, + newPrimarySaleHappened: null, + newIsMutable: null, + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + try { + await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + assert.fail("Metadata update verifying previously unverified creators should fail") + } catch(err) { + assert(err.message.includes('\"Custom\":6006'), "Did not fail because creator did not verify!"); + } + }); + }) + it('Linked to verified collection update', async () => { + const collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) + const [bubblegumSigner] = PublicKey.findProgramAddressSync([Buffer.from("collection_cpi")], BUBBLEGUM_PROGRAM_ID); + const metadataArgs = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); + + // Mint a New NFT to a Collection + const mintToCollectionIx = createMintToCollectionV1Instruction({ treeAuthority, - treeDelegate: payer, leafOwner: payer, leafDelegate: payer, - payer, merkleTree, - logWrapper: SPL_NOOP_PROGRAM_ID, - compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, - }, - { - root: Array.from(merkleAccount.getCurrentRoot()), - nonce: 0, - index: 0, - oldMetadata: originalCompressedNFT, - newName: 'NewName', - newSymbol: 'NewSymbol', - newUri: 'https://foobar.com', - newCreators: null, - newSellerFeeBasisPoints: null, - newPrimarySaleHappened: null, - newIsMutable: null, - }, - ); - - const updateMetadataTx = new Transaction().add(updateMetadataIx); - const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); - - console.log("Update metadata tx success:", updateMetadataTxId) - - const newMetadataArgs: MetadataArgs = { ...originalCompressedNFT, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; - - // We should now be able to verify the new leaf with the metadata replaced - await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, newMetadataArgs); - }); - it('Collection NFT Update', async () => { - const collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) - const [bubblegumSigner] = PublicKey.findProgramAddressSync([Buffer.from("collection_cpi")], BUBBLEGUM_PROGRAM_ID); - const metadataArgs = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); - const [treeAuthority] = PublicKey.findProgramAddressSync( - [merkleTree.toBuffer()], - BUBBLEGUM_PROGRAM_ID, - ); - - // Mint a New NFT to a Collection - const mintToCollectionIx = createMintToCollectionV1Instruction({ - treeAuthority, - leafOwner: payer, - leafDelegate: payer, - merkleTree, - payer, - treeDelegate: payer, - collectionAuthority: payer, - collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, - collectionMint: collection.mintAddress, - collectionMetadata: collection.metadataAddress, - editionAccount: collection.masterEditionAddress, - bubblegumSigner, - logWrapper: SPL_NOOP_PROGRAM_ID, - compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, - }, { - metadataArgs: metadataArgs - }); - - const mintToCollectionTxId = await sendAndConfirmTransaction(connection, new Transaction().add(mintToCollectionIx), [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); - - console.log("Mint to Collection Success:", mintToCollectionTxId); - - const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); - const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); - - // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree - // Thus we must alter the MetadataArgs object we expect to exist in the leaf before the update to match - const oldMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } - const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( - { - oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + payer, + treeDelegate: payer, collectionAuthority: payer, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, collectionMint: collection.mintAddress, collectionMetadata: collection.metadataAddress, - collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, - treeAuthority, - treeDelegate: payer, - leafOwner: payer, - leafDelegate: payer, - payer, - merkleTree, + editionAccount: collection.masterEditionAddress, + bubblegumSigner, logWrapper: SPL_NOOP_PROGRAM_ID, compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, - }, - { - root: Array.from(merkleAccount.getCurrentRoot()), - nonce: 1, - index: 1, - oldMetadata: oldMetadataArgs, - newName: 'NewName', - newSymbol: 'NewSymbol', - newUri: 'https://foobar.com', - newCreators: null, - newSellerFeeBasisPoints: null, - newPrimarySaleHappened: null, - newIsMutable: null, - }, - ); - - const updateMetadataTx = new Transaction().add(updateMetadataIx); - const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, { + metadataArgs: metadataArgs + }); + + const mintToCollectionTxId = await sendAndConfirmTransaction(connection, new Transaction().add(mintToCollectionIx), [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Mint to Collection Success:", mintToCollectionTxId); + + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); + + // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree + // Thus we must alter the MetadataArgs object we expect to exist in the leaf before the update to match + const oldMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } + const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( + { + oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + collectionAuthority: payer, + collectionMint: collection.mintAddress, + collectionMetadata: collection.metadataAddress, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 1, + index: 1, + oldMetadata: oldMetadataArgs, + newName: 'NewName', + newSymbol: 'NewSymbol', + newUri: 'https://foobar.com', + newCreators: null, + newSellerFeeBasisPoints: null, + newPrimarySaleHappened: null, + newIsMutable: null, + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + + console.log("Update metadata tx success:", updateMetadataTxId) + + const newMetadataArgs: MetadataArgs = { ...oldMetadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; + + // We should now be able to verify the new leaf with the metadata replaced + await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); }); - - console.log("Update metadata tx success:", updateMetadataTxId) - - const newMetadataArgs: MetadataArgs = { ...oldMetadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; - - // We should now be able to verify the new leaf with the metadata replaced - await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); - }); + }) it('Can transfer and burn a compressed NFT', async () => { // Transfer. diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index b7fc6a12..f1b7b743 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -1671,6 +1671,7 @@ pub mod bubblegum { .collection .as_ref() .ok_or(BubblegumError::NFTNotLinkedToVerifiedCollection)?; + assert_authority_matches_collection( collection, &ctx.accounts.collection_authority.to_account_info(), From ec91fce30a9104383dfe4c52b7a7e23f15db71cd Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Wed, 6 Sep 2023 18:13:07 -0700 Subject: [PATCH 12/17] Regenerate js client --- .../js/src/generated/errors/mplBubblegum.ts | 135 +++++--- .../js/src/generated/instructions/index.ts | 1 + .../generated/instructions/updateMetadata.ts | 66 ++-- .../updateMetadataCollectionNft.ts | 324 ++++++++++++++++++ .../js/src/generated/types/instructionName.ts | 1 + 5 files changed, 447 insertions(+), 80 deletions(-) create mode 100644 clients/js/src/generated/instructions/updateMetadataCollectionNft.ts diff --git a/clients/js/src/generated/errors/mplBubblegum.ts b/clients/js/src/generated/errors/mplBubblegum.ts index 2d18b383..bdc10ee4 100644 --- a/clients/js/src/generated/errors/mplBubblegum.ts +++ b/clients/js/src/generated/errors/mplBubblegum.ts @@ -394,9 +394,6 @@ nameToErrorMap.set('CollectionMustBeSized', CollectionMustBeSizedError); /** MetadataMintMismatch: Metadata mint does not match collection mint */ export class MetadataMintMismatchError extends ProgramError { readonly name: string = 'MetadataMintMismatch'; -/** MetadataImmutable: Metadata Not Mutable */ -export class MetadataImmutableError extends ProgramError { - readonly name: string = 'MetadataImmutable'; readonly code: number = 0x178b; // 6027 @@ -410,15 +407,6 @@ nameToErrorMap.set('MetadataMintMismatch', MetadataMintMismatchError); /** InvalidCollectionAuthority: Invalid collection authority */ export class InvalidCollectionAuthorityError extends ProgramError { readonly name: string = 'InvalidCollectionAuthority'; - super('Metadata Not Mutable', program, cause); - } -} -codeToErrorMap.set(0x178b, MetadataImmutableError); -nameToErrorMap.set('MetadataImmutable', MetadataImmutableError); - -/** CollectionMismatch: Collection mismatch */ -export class CollectionMismatchError extends ProgramError { - readonly name: string = 'CollectionMismatch'; readonly code: number = 0x178c; // 6028 @@ -435,15 +423,6 @@ nameToErrorMap.set( /** InvalidDelegateRecord: Invalid delegate record pda derivation */ export class InvalidDelegateRecordError extends ProgramError { readonly name: string = 'InvalidDelegateRecord'; - super('Collection mismatch', program, cause); - } -} -codeToErrorMap.set(0x178c, CollectionMismatchError); -nameToErrorMap.set('CollectionMismatch', CollectionMismatchError); - -/** MetadataArgsAmbiguous: MetadataArgs Ambiguous */ -export class MetadataArgsAmbiguousError extends ProgramError { - readonly name: string = 'MetadataArgsAmbiguous'; readonly code: number = 0x178d; // 6029 @@ -457,15 +436,6 @@ nameToErrorMap.set('InvalidDelegateRecord', InvalidDelegateRecordError); /** CollectionMasterEditionAccountInvalid: Edition account doesnt match collection */ export class CollectionMasterEditionAccountInvalidError extends ProgramError { readonly name: string = 'CollectionMasterEditionAccountInvalid'; - super('MetadataArgs Ambiguous', program, cause); - } -} -codeToErrorMap.set(0x178d, MetadataArgsAmbiguousError); -nameToErrorMap.set('MetadataArgsAmbiguous', MetadataArgsAmbiguousError); - -/** MetadataArgsMissing: MetadataArgs Missing */ -export class MetadataArgsMissingError extends ProgramError { - readonly name: string = 'MetadataArgsMissing'; readonly code: number = 0x178e; // 6030 @@ -482,15 +452,6 @@ nameToErrorMap.set( /** CollectionMustBeAUniqueMasterEdition: Collection Must Be a Unique Master Edition v2 */ export class CollectionMustBeAUniqueMasterEditionError extends ProgramError { readonly name: string = 'CollectionMustBeAUniqueMasterEdition'; - super('MetadataArgs Missing', program, cause); - } -} -codeToErrorMap.set(0x178e, MetadataArgsMissingError); -nameToErrorMap.set('MetadataArgsMissing', MetadataArgsMissingError); - -/** MissingCollectionAuthoritySignature: Missing Collection Authority Signature */ -export class MissingCollectionAuthoritySignatureError extends ProgramError { - readonly name: string = 'MissingCollectionAuthoritySignature'; readonly code: number = 0x178f; // 6031 @@ -530,13 +491,101 @@ export class DecompressionDisabledError extends ProgramError { codeToErrorMap.set(0x1791, DecompressionDisabledError); nameToErrorMap.set('DecompressionDisabled', DecompressionDisabledError); - super('Missing Collection Authority Signature', program, cause); +/** MetadataImmutable: Metadata not mutable */ +export class MetadataImmutableError extends ProgramError { + readonly name: string = 'MetadataImmutable'; + + readonly code: number = 0x1792; // 6034 + + constructor(program: Program, cause?: Error) { + super('Metadata not mutable', program, cause); + } +} +codeToErrorMap.set(0x1792, MetadataImmutableError); +nameToErrorMap.set('MetadataImmutable', MetadataImmutableError); + +/** CollectionMismatch: Collection mismatch */ +export class CollectionMismatchError extends ProgramError { + readonly name: string = 'CollectionMismatch'; + + readonly code: number = 0x1793; // 6035 + + constructor(program: Program, cause?: Error) { + super('Collection mismatch', program, cause); + } +} +codeToErrorMap.set(0x1793, CollectionMismatchError); +nameToErrorMap.set('CollectionMismatch', CollectionMismatchError); + +/** MetadataArgsAmbiguous: MetadataArgs ambiguous */ +export class MetadataArgsAmbiguousError extends ProgramError { + readonly name: string = 'MetadataArgsAmbiguous'; + + readonly code: number = 0x1794; // 6036 + + constructor(program: Program, cause?: Error) { + super('MetadataArgs ambiguous', program, cause); + } +} +codeToErrorMap.set(0x1794, MetadataArgsAmbiguousError); +nameToErrorMap.set('MetadataArgsAmbiguous', MetadataArgsAmbiguousError); + +/** MetadataArgsMissing: MetadataArgs missing */ +export class MetadataArgsMissingError extends ProgramError { + readonly name: string = 'MetadataArgsMissing'; + + readonly code: number = 0x1795; // 6037 + + constructor(program: Program, cause?: Error) { + super('MetadataArgs missing', program, cause); + } +} +codeToErrorMap.set(0x1795, MetadataArgsMissingError); +nameToErrorMap.set('MetadataArgsMissing', MetadataArgsMissingError); + +/** NFTLinkedToCollection: NFT linked to collection */ +export class NFTLinkedToCollectionError extends ProgramError { + readonly name: string = 'NFTLinkedToCollection'; + + readonly code: number = 0x1796; // 6038 + + constructor(program: Program, cause?: Error) { + super('NFT linked to collection', program, cause); + } +} +codeToErrorMap.set(0x1796, NFTLinkedToCollectionError); +nameToErrorMap.set('NFTLinkedToCollection', NFTLinkedToCollectionError); + +/** NFTNotLinkedToVerifiedCollection: NFT not linked to verified collection */ +export class NFTNotLinkedToVerifiedCollectionError extends ProgramError { + readonly name: string = 'NFTNotLinkedToVerifiedCollection'; + + readonly code: number = 0x1797; // 6039 + + constructor(program: Program, cause?: Error) { + super('NFT not linked to verified collection', program, cause); + } +} +codeToErrorMap.set(0x1797, NFTNotLinkedToVerifiedCollectionError); +nameToErrorMap.set( + 'NFTNotLinkedToVerifiedCollection', + NFTNotLinkedToVerifiedCollectionError +); + +/** PrimarySaleCanOnlyBeFlippedToTrue: Can only update primary sale to true */ +export class PrimarySaleCanOnlyBeFlippedToTrueError extends ProgramError { + readonly name: string = 'PrimarySaleCanOnlyBeFlippedToTrue'; + + readonly code: number = 0x1798; // 6040 + + constructor(program: Program, cause?: Error) { + super('Can only update primary sale to true', program, cause); } } -codeToErrorMap.set(0x178f, MissingCollectionAuthoritySignatureError); +codeToErrorMap.set(0x1798, PrimarySaleCanOnlyBeFlippedToTrueError); nameToErrorMap.set( - 'MissingCollectionAuthoritySignature', - MissingCollectionAuthoritySignatureError + 'PrimarySaleCanOnlyBeFlippedToTrue', + PrimarySaleCanOnlyBeFlippedToTrueError ); /** diff --git a/clients/js/src/generated/instructions/index.ts b/clients/js/src/generated/instructions/index.ts index e281f2b9..1495c764 100644 --- a/clients/js/src/generated/instructions/index.ts +++ b/clients/js/src/generated/instructions/index.ts @@ -21,6 +21,7 @@ export * from './transfer'; export * from './unverifyCollection'; export * from './unverifyCreator'; export * from './updateMetadata'; +export * from './updateMetadataCollectionNft'; export * from './verifyCollection'; export * from './verifyCreator'; export * from './verifyLeaf'; diff --git a/clients/js/src/generated/instructions/updateMetadata.ts b/clients/js/src/generated/instructions/updateMetadata.ts index ff336df3..521e3926 100644 --- a/clients/js/src/generated/instructions/updateMetadata.ts +++ b/clients/js/src/generated/instructions/updateMetadata.ts @@ -46,14 +46,10 @@ import { // Accounts. export type UpdateMetadataInstructionAccounts = { oldMetadataAcct?: PublicKey | Pda; - treeAuthority?: PublicKey | Pda; - treeDelegate: Signer; - collectionAuthority: PublicKey | Pda; - collectionMint: PublicKey | Pda; - collectionMetadata: PublicKey | Pda; - collectionAuthorityRecordPda: PublicKey | Pda; + treeConfig?: PublicKey | Pda; + treeCreatorOrDelegate?: Signer; leafOwner: PublicKey | Pda; - leafDelegate: PublicKey | Pda; + leafDelegate?: PublicKey | Pda; payer?: Signer; merkleTree: PublicKey | Pda; logWrapper?: PublicKey | Pda; @@ -66,6 +62,8 @@ export type UpdateMetadataInstructionAccounts = { export type UpdateMetadataInstructionData = { discriminator: Array; root: Uint8Array; + nonce: bigint; + index: number; oldMetadata: Option; newName: Option; newSymbol: Option; @@ -74,12 +72,12 @@ export type UpdateMetadataInstructionData = { newSellerFeeBasisPoints: Option; newPrimarySaleHappened: Option; newIsMutable: Option; - nonce: bigint; - index: number; }; export type UpdateMetadataInstructionDataArgs = { root: Uint8Array; + nonce: number | bigint; + index: number; oldMetadata: OptionOrNullable; newName: OptionOrNullable; newSymbol: OptionOrNullable; @@ -88,8 +86,6 @@ export type UpdateMetadataInstructionDataArgs = { newSellerFeeBasisPoints: OptionOrNullable; newPrimarySaleHappened: OptionOrNullable; newIsMutable: OptionOrNullable; - nonce: number | bigint; - index: number; }; /** @deprecated Use `getUpdateMetadataInstructionDataSerializer()` without any argument instead. */ @@ -115,6 +111,8 @@ export function getUpdateMetadataInstructionDataSerializer( [ ['discriminator', array(u8(), { size: 8 })], ['root', bytes({ size: 32 })], + ['nonce', u64()], + ['index', u32()], ['oldMetadata', option(getMetadataArgsSerializer())], ['newName', option(string())], ['newSymbol', option(string())], @@ -123,8 +121,6 @@ export function getUpdateMetadataInstructionDataSerializer( ['newSellerFeeBasisPoints', option(u16())], ['newPrimarySaleHappened', option(bool())], ['newIsMutable', option(bool())], - ['nonce', u64()], - ['index', u32()], ], { description: 'UpdateMetadataInstructionData' } ), @@ -143,7 +139,7 @@ export type UpdateMetadataInstructionArgs = UpdateMetadataInstructionDataArgs; // Instruction. export function updateMetadata( - context: Pick, + context: Pick, input: UpdateMetadataInstructionAccounts & UpdateMetadataInstructionArgs ): TransactionBuilder { const signers: Signer[] = []; @@ -157,16 +153,7 @@ export function updateMetadata( // Resolved inputs. const resolvedAccounts = { - treeDelegate: [input.treeDelegate, false] as const, - collectionAuthority: [input.collectionAuthority, false] as const, - collectionMint: [input.collectionMint, false] as const, - collectionMetadata: [input.collectionMetadata, false] as const, - collectionAuthorityRecordPda: [ - input.collectionAuthorityRecordPda, - false, - ] as const, leafOwner: [input.leafOwner, false] as const, - leafDelegate: [input.leafDelegate, false] as const, merkleTree: [input.merkleTree, true] as const, }; const resolvingArgs = {}; @@ -179,9 +166,9 @@ export function updateMetadata( ); addObjectProperty( resolvedAccounts, - 'treeAuthority', - input.treeAuthority - ? ([input.treeAuthority, false] as const) + 'treeConfig', + input.treeConfig + ? ([input.treeConfig, false] as const) : ([ findTreeConfigPda(context, { merkleTree: publicKey(input.merkleTree, false), @@ -189,6 +176,20 @@ export function updateMetadata( false, ] as const) ); + addObjectProperty( + resolvedAccounts, + 'treeCreatorOrDelegate', + input.treeCreatorOrDelegate + ? ([input.treeCreatorOrDelegate, false] as const) + : ([context.identity, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'leafDelegate', + input.leafDelegate + ? ([input.leafDelegate, false] as const) + : ([input.leafOwner, false] as const) + ); addObjectProperty( resolvedAccounts, 'payer', @@ -251,17 +252,8 @@ export function updateMetadata( const resolvedArgs = { ...input, ...resolvingArgs }; addAccountMeta(keys, signers, resolvedAccounts.oldMetadataAcct, false); - addAccountMeta(keys, signers, resolvedAccounts.treeAuthority, false); - addAccountMeta(keys, signers, resolvedAccounts.treeDelegate, false); - addAccountMeta(keys, signers, resolvedAccounts.collectionAuthority, false); - addAccountMeta(keys, signers, resolvedAccounts.collectionMint, false); - addAccountMeta(keys, signers, resolvedAccounts.collectionMetadata, false); - addAccountMeta( - keys, - signers, - resolvedAccounts.collectionAuthorityRecordPda, - false - ); + addAccountMeta(keys, signers, resolvedAccounts.treeConfig, false); + addAccountMeta(keys, signers, resolvedAccounts.treeCreatorOrDelegate, false); addAccountMeta(keys, signers, resolvedAccounts.leafOwner, false); addAccountMeta(keys, signers, resolvedAccounts.leafDelegate, false); addAccountMeta(keys, signers, resolvedAccounts.payer, false); diff --git a/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts new file mode 100644 index 00000000..9929c5e7 --- /dev/null +++ b/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts @@ -0,0 +1,324 @@ +/** + * 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 { findMetadataPda } from '@metaplex-foundation/mpl-token-metadata'; +import { + AccountMeta, + Context, + Option, + OptionOrNullable, + Pda, + PublicKey, + Signer, + TransactionBuilder, + publicKey, + transactionBuilder, +} from '@metaplex-foundation/umi'; +import { + Serializer, + array, + bool, + bytes, + mapSerializer, + option, + string, + struct, + u16, + u32, + u64, + u8, +} from '@metaplex-foundation/umi/serializers'; +import { findTreeConfigPda } from '../accounts'; +import { addAccountMeta, addObjectProperty } from '../shared'; +import { + Creator, + CreatorArgs, + MetadataArgs, + MetadataArgsArgs, + getCreatorSerializer, + getMetadataArgsSerializer, +} from '../types'; + +// Accounts. +export type UpdateMetadataCollectionNftInstructionAccounts = { + oldMetadataAcct?: PublicKey | Pda; + treeConfig?: PublicKey | Pda; + treeCreatorOrDelegate?: Signer; + collectionAuthority?: Signer; + collectionMint: PublicKey | Pda; + collectionMetadata?: PublicKey | Pda; + collectionAuthorityRecordPda?: PublicKey | Pda; + leafOwner: PublicKey | Pda; + leafDelegate?: PublicKey | Pda; + payer?: Signer; + merkleTree: PublicKey | Pda; + logWrapper?: PublicKey | Pda; + compressionProgram?: PublicKey | Pda; + tokenMetadataProgram?: PublicKey | Pda; + systemProgram?: PublicKey | Pda; +}; + +// Data. +export type UpdateMetadataCollectionNftInstructionData = { + discriminator: Array; + root: Uint8Array; + nonce: bigint; + index: number; + oldMetadata: Option; + newName: Option; + newSymbol: Option; + newUri: Option; + newCreators: Option>; + newSellerFeeBasisPoints: Option; + newPrimarySaleHappened: Option; + newIsMutable: Option; +}; + +export type UpdateMetadataCollectionNftInstructionDataArgs = { + root: Uint8Array; + nonce: number | bigint; + index: number; + oldMetadata: OptionOrNullable; + newName: OptionOrNullable; + newSymbol: OptionOrNullable; + newUri: OptionOrNullable; + newCreators: OptionOrNullable>; + newSellerFeeBasisPoints: OptionOrNullable; + newPrimarySaleHappened: OptionOrNullable; + newIsMutable: OptionOrNullable; +}; + +/** @deprecated Use `getUpdateMetadataCollectionNftInstructionDataSerializer()` without any argument instead. */ +export function getUpdateMetadataCollectionNftInstructionDataSerializer( + _context: object +): Serializer< + UpdateMetadataCollectionNftInstructionDataArgs, + UpdateMetadataCollectionNftInstructionData +>; +export function getUpdateMetadataCollectionNftInstructionDataSerializer(): Serializer< + UpdateMetadataCollectionNftInstructionDataArgs, + UpdateMetadataCollectionNftInstructionData +>; +export function getUpdateMetadataCollectionNftInstructionDataSerializer( + _context: object = {} +): Serializer< + UpdateMetadataCollectionNftInstructionDataArgs, + UpdateMetadataCollectionNftInstructionData +> { + return mapSerializer< + UpdateMetadataCollectionNftInstructionDataArgs, + any, + UpdateMetadataCollectionNftInstructionData + >( + struct( + [ + ['discriminator', array(u8(), { size: 8 })], + ['root', bytes({ size: 32 })], + ['nonce', u64()], + ['index', u32()], + ['oldMetadata', option(getMetadataArgsSerializer())], + ['newName', option(string())], + ['newSymbol', option(string())], + ['newUri', option(string())], + ['newCreators', option(array(getCreatorSerializer()))], + ['newSellerFeeBasisPoints', option(u16())], + ['newPrimarySaleHappened', option(bool())], + ['newIsMutable', option(bool())], + ], + { description: 'UpdateMetadataCollectionNftInstructionData' } + ), + (value) => ({ + ...value, + discriminator: [244, 12, 175, 194, 227, 28, 102, 215], + }) + ) as Serializer< + UpdateMetadataCollectionNftInstructionDataArgs, + UpdateMetadataCollectionNftInstructionData + >; +} + +// Args. +export type UpdateMetadataCollectionNftInstructionArgs = + UpdateMetadataCollectionNftInstructionDataArgs; + +// Instruction. +export function updateMetadataCollectionNft( + context: Pick, + input: UpdateMetadataCollectionNftInstructionAccounts & + UpdateMetadataCollectionNftInstructionArgs +): TransactionBuilder { + const signers: Signer[] = []; + const keys: AccountMeta[] = []; + + // Program ID. + const programId = context.programs.getPublicKey( + 'mplBubblegum', + 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY' + ); + + // Resolved inputs. + const resolvedAccounts = { + collectionMint: [input.collectionMint, false] as const, + leafOwner: [input.leafOwner, false] as const, + merkleTree: [input.merkleTree, true] as const, + }; + const resolvingArgs = {}; + addObjectProperty( + resolvedAccounts, + 'oldMetadataAcct', + input.oldMetadataAcct + ? ([input.oldMetadataAcct, false] as const) + : ([programId, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'treeConfig', + input.treeConfig + ? ([input.treeConfig, false] as const) + : ([ + findTreeConfigPda(context, { + merkleTree: publicKey(input.merkleTree, false), + }), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'treeCreatorOrDelegate', + input.treeCreatorOrDelegate + ? ([input.treeCreatorOrDelegate, false] as const) + : ([context.identity, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'collectionAuthority', + input.collectionAuthority + ? ([input.collectionAuthority, false] as const) + : ([context.identity, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'collectionMetadata', + input.collectionMetadata + ? ([input.collectionMetadata, false] as const) + : ([ + findMetadataPda(context, { + mint: publicKey(input.collectionMint, false), + }), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'collectionAuthorityRecordPda', + input.collectionAuthorityRecordPda + ? ([input.collectionAuthorityRecordPda, false] as const) + : ([programId, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'leafDelegate', + input.leafDelegate + ? ([input.leafDelegate, false] as const) + : ([input.leafOwner, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'payer', + input.payer + ? ([input.payer, false] as const) + : ([context.payer, false] as const) + ); + addObjectProperty( + resolvedAccounts, + 'logWrapper', + input.logWrapper + ? ([input.logWrapper, false] as const) + : ([ + context.programs.getPublicKey( + 'splNoop', + 'noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV' + ), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'compressionProgram', + input.compressionProgram + ? ([input.compressionProgram, false] as const) + : ([ + context.programs.getPublicKey( + 'splAccountCompression', + 'cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK' + ), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'tokenMetadataProgram', + input.tokenMetadataProgram + ? ([input.tokenMetadataProgram, false] as const) + : ([ + context.programs.getPublicKey( + 'mplTokenMetadata', + 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' + ), + false, + ] as const) + ); + addObjectProperty( + resolvedAccounts, + 'systemProgram', + input.systemProgram + ? ([input.systemProgram, false] as const) + : ([ + context.programs.getPublicKey( + 'splSystem', + '11111111111111111111111111111111' + ), + false, + ] as const) + ); + const resolvedArgs = { ...input, ...resolvingArgs }; + + addAccountMeta(keys, signers, resolvedAccounts.oldMetadataAcct, false); + addAccountMeta(keys, signers, resolvedAccounts.treeConfig, false); + addAccountMeta(keys, signers, resolvedAccounts.treeCreatorOrDelegate, false); + addAccountMeta(keys, signers, resolvedAccounts.collectionAuthority, false); + addAccountMeta(keys, signers, resolvedAccounts.collectionMint, false); + addAccountMeta(keys, signers, resolvedAccounts.collectionMetadata, false); + addAccountMeta( + keys, + signers, + resolvedAccounts.collectionAuthorityRecordPda, + false + ); + addAccountMeta(keys, signers, resolvedAccounts.leafOwner, false); + addAccountMeta(keys, signers, resolvedAccounts.leafDelegate, false); + addAccountMeta(keys, signers, resolvedAccounts.payer, false); + addAccountMeta(keys, signers, resolvedAccounts.merkleTree, false); + addAccountMeta(keys, signers, resolvedAccounts.logWrapper, false); + addAccountMeta(keys, signers, resolvedAccounts.compressionProgram, false); + addAccountMeta(keys, signers, resolvedAccounts.tokenMetadataProgram, false); + addAccountMeta(keys, signers, resolvedAccounts.systemProgram, false); + + // Data. + const data = + getUpdateMetadataCollectionNftInstructionDataSerializer().serialize( + resolvedArgs + ); + + // Bytes Created On Chain. + const bytesCreatedOnChain = 0; + + return transactionBuilder([ + { instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, + ]); +} diff --git a/clients/js/src/generated/types/instructionName.ts b/clients/js/src/generated/types/instructionName.ts index 473a0ffd..c701b436 100644 --- a/clients/js/src/generated/types/instructionName.ts +++ b/clients/js/src/generated/types/instructionName.ts @@ -27,6 +27,7 @@ export enum InstructionName { MintToCollectionV1, SetDecompressableState, UpdateMetadata, + UpdateMetadataCollectionNft, } export type InstructionNameArgs = InstructionName; From bd82228506b554d22d69bead874a94659d1b5209 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:51:56 -0700 Subject: [PATCH 13/17] Rename old_metadata to current_metadata --- .../generated/instructions/updateMetadata.ts | 16 ++-- .../updateMetadataCollectionNft.ts | 16 ++-- idls/bubblegum.json | 8 +- programs/bubblegum/program/src/lib.rs | 93 ++++++++++--------- 4 files changed, 69 insertions(+), 64 deletions(-) diff --git a/clients/js/src/generated/instructions/updateMetadata.ts b/clients/js/src/generated/instructions/updateMetadata.ts index 521e3926..961afe9e 100644 --- a/clients/js/src/generated/instructions/updateMetadata.ts +++ b/clients/js/src/generated/instructions/updateMetadata.ts @@ -45,7 +45,7 @@ import { // Accounts. export type UpdateMetadataInstructionAccounts = { - oldMetadataAcct?: PublicKey | Pda; + metadataBuffer?: PublicKey | Pda; treeConfig?: PublicKey | Pda; treeCreatorOrDelegate?: Signer; leafOwner: PublicKey | Pda; @@ -64,7 +64,7 @@ export type UpdateMetadataInstructionData = { root: Uint8Array; nonce: bigint; index: number; - oldMetadata: Option; + currentMetadata: Option; newName: Option; newSymbol: Option; newUri: Option; @@ -78,7 +78,7 @@ export type UpdateMetadataInstructionDataArgs = { root: Uint8Array; nonce: number | bigint; index: number; - oldMetadata: OptionOrNullable; + currentMetadata: OptionOrNullable; newName: OptionOrNullable; newSymbol: OptionOrNullable; newUri: OptionOrNullable; @@ -113,7 +113,7 @@ export function getUpdateMetadataInstructionDataSerializer( ['root', bytes({ size: 32 })], ['nonce', u64()], ['index', u32()], - ['oldMetadata', option(getMetadataArgsSerializer())], + ['currentMetadata', option(getMetadataArgsSerializer())], ['newName', option(string())], ['newSymbol', option(string())], ['newUri', option(string())], @@ -159,9 +159,9 @@ export function updateMetadata( const resolvingArgs = {}; addObjectProperty( resolvedAccounts, - 'oldMetadataAcct', - input.oldMetadataAcct - ? ([input.oldMetadataAcct, false] as const) + 'metadataBuffer', + input.metadataBuffer + ? ([input.metadataBuffer, false] as const) : ([programId, false] as const) ); addObjectProperty( @@ -251,7 +251,7 @@ export function updateMetadata( ); const resolvedArgs = { ...input, ...resolvingArgs }; - addAccountMeta(keys, signers, resolvedAccounts.oldMetadataAcct, false); + addAccountMeta(keys, signers, resolvedAccounts.metadataBuffer, false); addAccountMeta(keys, signers, resolvedAccounts.treeConfig, false); addAccountMeta(keys, signers, resolvedAccounts.treeCreatorOrDelegate, false); addAccountMeta(keys, signers, resolvedAccounts.leafOwner, false); diff --git a/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts index 9929c5e7..7bd8531b 100644 --- a/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts +++ b/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts @@ -46,7 +46,7 @@ import { // Accounts. export type UpdateMetadataCollectionNftInstructionAccounts = { - oldMetadataAcct?: PublicKey | Pda; + metadataBuffer?: PublicKey | Pda; treeConfig?: PublicKey | Pda; treeCreatorOrDelegate?: Signer; collectionAuthority?: Signer; @@ -69,7 +69,7 @@ export type UpdateMetadataCollectionNftInstructionData = { root: Uint8Array; nonce: bigint; index: number; - oldMetadata: Option; + currentMetadata: Option; newName: Option; newSymbol: Option; newUri: Option; @@ -83,7 +83,7 @@ export type UpdateMetadataCollectionNftInstructionDataArgs = { root: Uint8Array; nonce: number | bigint; index: number; - oldMetadata: OptionOrNullable; + currentMetadata: OptionOrNullable; newName: OptionOrNullable; newSymbol: OptionOrNullable; newUri: OptionOrNullable; @@ -121,7 +121,7 @@ export function getUpdateMetadataCollectionNftInstructionDataSerializer( ['root', bytes({ size: 32 })], ['nonce', u64()], ['index', u32()], - ['oldMetadata', option(getMetadataArgsSerializer())], + ['currentMetadata', option(getMetadataArgsSerializer())], ['newName', option(string())], ['newSymbol', option(string())], ['newUri', option(string())], @@ -170,9 +170,9 @@ export function updateMetadataCollectionNft( const resolvingArgs = {}; addObjectProperty( resolvedAccounts, - 'oldMetadataAcct', - input.oldMetadataAcct - ? ([input.oldMetadataAcct, false] as const) + 'metadataBuffer', + input.metadataBuffer + ? ([input.metadataBuffer, false] as const) : ([programId, false] as const) ); addObjectProperty( @@ -288,7 +288,7 @@ export function updateMetadataCollectionNft( ); const resolvedArgs = { ...input, ...resolvingArgs }; - addAccountMeta(keys, signers, resolvedAccounts.oldMetadataAcct, false); + addAccountMeta(keys, signers, resolvedAccounts.metadataBuffer, false); addAccountMeta(keys, signers, resolvedAccounts.treeConfig, false); addAccountMeta(keys, signers, resolvedAccounts.treeCreatorOrDelegate, false); addAccountMeta(keys, signers, resolvedAccounts.collectionAuthority, false); diff --git a/idls/bubblegum.json b/idls/bubblegum.json index 7a9658a1..5a5e341c 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1087,7 +1087,7 @@ "name": "updateMetadata", "accounts": [ { - "name": "oldMetadataAcct", + "name": "metadataBuffer", "isMut": false, "isSigner": false, "isOptional": true @@ -1162,7 +1162,7 @@ "type": "u32" }, { - "name": "oldMetadata", + "name": "currentMetadata", "type": { "option": { "defined": "MetadataArgs" @@ -1221,7 +1221,7 @@ "name": "updateMetadataCollectionNft", "accounts": [ { - "name": "oldMetadataAcct", + "name": "metadataBuffer", "isMut": false, "isSigner": false, "isOptional": true @@ -1317,7 +1317,7 @@ "type": "u32" }, { - "name": "oldMetadata", + "name": "currentMetadata", "type": { "option": { "defined": "MetadataArgs" diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index f1b7b743..c1dd8f69 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -253,9 +253,9 @@ pub struct Delegate<'info> { #[derive(Accounts)] pub struct UpdateMetadata<'info> { - /// CHECK: Can optionally specify the old_metadata of the leaf through an account to save transaction space + /// CHECK: Can optionally specify the old metadata of the leaf through an account to save transaction space /// CHECK: This account is checked in the instruction - pub old_metadata_acct: Option>, + pub metadata_buffer: Option>, #[account( seeds = [merkle_tree.key().as_ref()], bump, @@ -279,9 +279,9 @@ pub struct UpdateMetadata<'info> { #[derive(Accounts)] pub struct UpdateMetadataCollectionNFT<'info> { - /// CHECK: Can optionally specify the old_metadata of the leaf through an account to save transaction space + /// CHECK: Can optionally specify the old metadata of the leaf through an account to save transaction space /// CHECK: This account is checked in the instruction - pub old_metadata_acct: Option>, + pub metadata_buffer: Option>, #[account( seeds = [merkle_tree.key().as_ref()], bump, @@ -961,27 +961,27 @@ fn assert_signed_by_tree_delegate( Ok(()) } -fn fetch_old_metadata_args( - old_metadata_arg: Option, - old_metadata_acct: &Option, +fn fetch_current_metadata( + current_metadata_args: Option, + metadata_buffer: &Option, ) -> Result { - let old_metadata = match old_metadata_arg { + let current_metadata = match current_metadata_args { Some(metadata) => { require!( - old_metadata_acct.is_none(), + metadata_buffer.is_none(), BubblegumError::MetadataArgsAmbiguous ); metadata } None => { - let old_metadata_account = old_metadata_acct + let metadata_account = metadata_buffer .as_ref() .ok_or(BubblegumError::MetadataArgsMissing)?; - let old_metadata_data = old_metadata_account.try_borrow_data()?; - MetadataArgs::deserialize(&mut old_metadata_data.as_ref())? + let metadata_data = metadata_account.try_borrow_data()?; + MetadataArgs::deserialize(&mut metadata_data.as_ref())? } }; - Ok(old_metadata) + Ok(current_metadata) } fn assert_authority_matches_collection<'info>( @@ -1039,7 +1039,7 @@ fn process_update_metadata<'info>( log_wrapper: &Program<'info, Noop>, remaining_accounts: &[AccountInfo<'info>], root: [u8; 32], - old_metadata: MetadataArgs, + current_metadata: MetadataArgs, new_name: Option, new_symbol: Option, new_uri: Option, @@ -1051,24 +1051,27 @@ fn process_update_metadata<'info>( index: u32, ) -> Result<()> { // Old metadata must be mutable to allow metadata update - require!(old_metadata.is_mutable, BubblegumError::MetadataImmutable); + require!( + current_metadata.is_mutable, + BubblegumError::MetadataImmutable + ); - let old_data_hash = hash_metadata(&old_metadata)?; - let old_creator_hash = hash_creators(&old_metadata.creators)?; + let current_data_hash = hash_metadata(¤t_metadata)?; + let current_creator_hash = hash_creators(¤t_metadata.creators)?; // Update metadata - let mut new_metadata = old_metadata; + let mut updated_metadata = current_metadata; if let Some(name) = new_name { - new_metadata.name = name; + updated_metadata.name = name; }; if let Some(symbol) = new_symbol { - new_metadata.symbol = symbol; + updated_metadata.symbol = symbol; }; if let Some(uri) = new_uri { - new_metadata.uri = uri; + updated_metadata.uri = uri; }; if let Some(creators) = new_creators { - let old_creators = new_metadata.creators; + let old_creators = updated_metadata.creators; let no_new_creators_were_verified = creators .iter() .filter(|c| c.verified) // select only creators that are verified @@ -1081,26 +1084,26 @@ fn process_update_metadata<'info>( no_new_creators_were_verified, BubblegumError::CreatorDidNotVerify ); - new_metadata.creators = creators; + updated_metadata.creators = creators; } if let Some(seller_fee_basis_points) = new_seller_fee_basis_points { - new_metadata.seller_fee_basis_points = seller_fee_basis_points + updated_metadata.seller_fee_basis_points = seller_fee_basis_points }; if let Some(primary_sale_happened) = new_primary_sale_happened { // a new value of primary_sale_happened should only be specified if primary_sale_happened was false in the original metadata require!( - !new_metadata.primary_sale_happened, + !updated_metadata.primary_sale_happened, BubblegumError::PrimarySaleCanOnlyBeFlippedToTrue ); - new_metadata.primary_sale_happened = primary_sale_happened; + updated_metadata.primary_sale_happened = primary_sale_happened; }; if let Some(is_mutable) = new_is_mutable { - new_metadata.is_mutable = is_mutable; + updated_metadata.is_mutable = is_mutable; }; - assert_metadata_is_mpl_compatible(&new_metadata)?; - let new_data_hash = hash_metadata(&new_metadata)?; - let new_creator_hash = hash_creators(&new_metadata.creators)?; + assert_metadata_is_mpl_compatible(&updated_metadata)?; + let updated_data_hash = hash_metadata(&updated_metadata)?; + let updated_creator_hash = hash_creators(&updated_metadata.creators)?; let asset_id = get_asset_id(&merkle_tree.key(), nonce); let previous_leaf = LeafSchema::new_v0( @@ -1108,16 +1111,16 @@ fn process_update_metadata<'info>( owner.key(), delegate.key(), nonce, - old_data_hash, - old_creator_hash, + current_data_hash, + current_creator_hash, ); let new_leaf = LeafSchema::new_v0( asset_id, owner.key(), delegate.key(), nonce, - new_data_hash, - new_creator_hash, + updated_data_hash, + updated_creator_hash, ); wrap_application_data_v1(new_leaf.to_event().try_to_vec()?, log_wrapper)?; @@ -1602,7 +1605,7 @@ pub mod bubblegum { root: [u8; 32], nonce: u64, index: u32, - old_metadata: Option, + current_metadata: Option, new_name: Option, new_symbol: Option, new_uri: Option, @@ -1614,12 +1617,13 @@ pub mod bubblegum { assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; // Determine how the user opted to pass in the old MetadataArgs - let old_metadata = fetch_old_metadata_args(old_metadata, &ctx.accounts.old_metadata_acct)?; + let current_metadata = + fetch_current_metadata(current_metadata, &ctx.accounts.metadata_buffer)?; // NFTs which are linked to verified collections cannot be updated through this instruction require!( - old_metadata.collection.is_none() - || !old_metadata.collection.as_ref().unwrap().verified, + current_metadata.collection.is_none() + || !current_metadata.collection.as_ref().unwrap().verified, BubblegumError::NFTLinkedToCollection ); @@ -1633,7 +1637,7 @@ pub mod bubblegum { &ctx.accounts.log_wrapper, ctx.remaining_accounts, root, - old_metadata, + current_metadata, new_name, new_symbol, new_uri, @@ -1651,7 +1655,7 @@ pub mod bubblegum { root: [u8; 32], nonce: u64, index: u32, - old_metadata: Option, + current_metadata: Option, new_name: Option, new_symbol: Option, new_uri: Option, @@ -1663,15 +1667,16 @@ pub mod bubblegum { assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; // Determine how the user opted to pass in the old MetadataArgs - let old_metadata = fetch_old_metadata_args(old_metadata, &ctx.accounts.old_metadata_acct)?; + let current_metadata = + fetch_current_metadata(current_metadata, &ctx.accounts.metadata_buffer)?; // NFTs updated through this instruction must be linked to a collection, // so a collection authority for that collection must sign - let collection = old_metadata + let collection = current_metadata .collection .as_ref() .ok_or(BubblegumError::NFTNotLinkedToVerifiedCollection)?; - + assert_authority_matches_collection( collection, &ctx.accounts.collection_authority.to_account_info(), @@ -1692,7 +1697,7 @@ pub mod bubblegum { &ctx.accounts.log_wrapper, ctx.remaining_accounts, root, - old_metadata, + current_metadata, new_name, new_symbol, new_uri, From 2d65a4b4c0fd9798e1869b30ddc1e04bb2253430 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Mon, 18 Sep 2023 16:06:18 -0700 Subject: [PATCH 14/17] Use UpdateArgs to group new metadata params --- .../generated/instructions/updateMetadata.ts | 31 ++-- .../updateMetadataCollectionNft.ts | 37 ++--- .../src/generated/types/LeafSchema.ts | 2 +- .../src/generated/types/UpdateArgs.ts | 35 +++++ .../js-solita/src/generated/types/index.ts | 1 + clients/js-solita/tests/main.test.ts | 70 +++++---- clients/js-solita/yarn.lock | 77 +++++++++- .../generated/instructions/updateMetadata.ts | 33 +--- .../updateMetadataCollectionNft.ts | 33 +--- clients/js/src/generated/types/index.ts | 1 + clients/js/src/generated/types/updateArgs.ts | 64 ++++++++ idls/bubblegum.json | 142 +++++++----------- programs/bubblegum/program/src/lib.rs | 58 ++----- .../program/src/state/metaplex_adapter.rs | 11 ++ 14 files changed, 337 insertions(+), 258 deletions(-) create mode 100644 clients/js-solita/src/generated/types/UpdateArgs.ts create mode 100644 clients/js/src/generated/types/updateArgs.ts diff --git a/clients/js-solita/src/generated/instructions/updateMetadata.ts b/clients/js-solita/src/generated/instructions/updateMetadata.ts index a584a692..cb706629 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadata.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadata.ts @@ -8,7 +8,7 @@ import * as beet from '@metaplex-foundation/beet'; import * as web3 from '@solana/web3.js'; import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; -import { Creator, creatorBeet } from '../types/Creator'; +import { UpdateArgs, updateArgsBeet } from '../types/UpdateArgs'; /** * @category Instructions @@ -19,14 +19,8 @@ export type UpdateMetadataInstructionArgs = { root: number[] /* size: 32 */; nonce: beet.bignum; index: number; - oldMetadata: beet.COption; - newName: beet.COption; - newSymbol: beet.COption; - newUri: beet.COption; - newCreators: beet.COption; - newSellerFeeBasisPoints: beet.COption; - newPrimarySaleHappened: beet.COption; - newIsMutable: beet.COption; + currentMetadata: beet.COption; + updateArgs: UpdateArgs; }; /** * @category Instructions @@ -43,21 +37,15 @@ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< ['root', beet.uniformFixedSizeArray(beet.u8, 32)], ['nonce', beet.u64], ['index', beet.u32], - ['oldMetadata', beet.coption(metadataArgsBeet)], - ['newName', beet.coption(beet.utf8String)], - ['newSymbol', beet.coption(beet.utf8String)], - ['newUri', beet.coption(beet.utf8String)], - ['newCreators', beet.coption(beet.array(creatorBeet))], - ['newSellerFeeBasisPoints', beet.coption(beet.u16)], - ['newPrimarySaleHappened', beet.coption(beet.bool)], - ['newIsMutable', beet.coption(beet.bool)], + ['currentMetadata', beet.coption(metadataArgsBeet)], + ['updateArgs', updateArgsBeet], ], 'UpdateMetadataInstructionArgs', ); /** * Accounts required by the _updateMetadata_ instruction * - * @property [] oldMetadataAcct + * @property [] metadataBuffer (optional) * @property [] treeAuthority * @property [**signer**] treeDelegate * @property [] leafOwner @@ -72,7 +60,7 @@ export const updateMetadataStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UpdateMetadataInstructionAccounts = { - oldMetadataAcct: web3.PublicKey; + metadataBuffer?: web3.PublicKey; treeAuthority: web3.PublicKey; treeDelegate: web3.PublicKey; leafOwner: web3.PublicKey; @@ -91,6 +79,9 @@ export const updateMetadataInstructionDiscriminator = [170, 182, 43, 239, 97, 78 /** * Creates a _UpdateMetadata_ instruction. * + * Optional accounts that are not provided default to the program ID since + * this was indicated in the IDL from which this instruction was generated. + * * @param accounts that will be accessed while the instruction is processed * @param args to provide as instruction data to the program * @@ -109,7 +100,7 @@ export function createUpdateMetadataInstruction( }); const keys: web3.AccountMeta[] = [ { - pubkey: accounts.oldMetadataAcct, + pubkey: accounts.metadataBuffer ?? programId, isWritable: false, isSigner: false, }, diff --git a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts index f0b41179..36dec258 100644 --- a/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts +++ b/clients/js-solita/src/generated/instructions/updateMetadataCollectionNft.ts @@ -8,7 +8,7 @@ import * as beet from '@metaplex-foundation/beet'; import * as web3 from '@solana/web3.js'; import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs'; -import { Creator, creatorBeet } from '../types/Creator'; +import { UpdateArgs, updateArgsBeet } from '../types/UpdateArgs'; /** * @category Instructions @@ -19,14 +19,8 @@ export type UpdateMetadataCollectionNftInstructionArgs = { root: number[] /* size: 32 */; nonce: beet.bignum; index: number; - oldMetadata: beet.COption; - newName: beet.COption; - newSymbol: beet.COption; - newUri: beet.COption; - newCreators: beet.COption; - newSellerFeeBasisPoints: beet.COption; - newPrimarySaleHappened: beet.COption; - newIsMutable: beet.COption; + currentMetadata: beet.COption; + updateArgs: UpdateArgs; }; /** * @category Instructions @@ -43,27 +37,21 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< ['root', beet.uniformFixedSizeArray(beet.u8, 32)], ['nonce', beet.u64], ['index', beet.u32], - ['oldMetadata', beet.coption(metadataArgsBeet)], - ['newName', beet.coption(beet.utf8String)], - ['newSymbol', beet.coption(beet.utf8String)], - ['newUri', beet.coption(beet.utf8String)], - ['newCreators', beet.coption(beet.array(creatorBeet))], - ['newSellerFeeBasisPoints', beet.coption(beet.u16)], - ['newPrimarySaleHappened', beet.coption(beet.bool)], - ['newIsMutable', beet.coption(beet.bool)], + ['currentMetadata', beet.coption(metadataArgsBeet)], + ['updateArgs', updateArgsBeet], ], 'UpdateMetadataCollectionNftInstructionArgs', ); /** * Accounts required by the _updateMetadataCollectionNft_ instruction * - * @property [] oldMetadataAcct + * @property [] metadataBuffer (optional) * @property [] treeAuthority * @property [**signer**] treeDelegate * @property [**signer**] collectionAuthority * @property [] collectionMint * @property [] collectionMetadata - * @property [] collectionAuthorityRecordPda + * @property [] collectionAuthorityRecordPda (optional) * @property [] leafOwner * @property [] leafDelegate * @property [**signer**] payer @@ -76,13 +64,13 @@ export const updateMetadataCollectionNftStruct = new beet.FixableBeetArgsStruct< * @category generated */ export type UpdateMetadataCollectionNftInstructionAccounts = { - oldMetadataAcct: web3.PublicKey; + metadataBuffer?: web3.PublicKey; treeAuthority: web3.PublicKey; treeDelegate: web3.PublicKey; collectionAuthority: web3.PublicKey; collectionMint: web3.PublicKey; collectionMetadata: web3.PublicKey; - collectionAuthorityRecordPda: web3.PublicKey; + collectionAuthorityRecordPda?: web3.PublicKey; leafOwner: web3.PublicKey; leafDelegate: web3.PublicKey; payer: web3.PublicKey; @@ -101,6 +89,9 @@ export const updateMetadataCollectionNftInstructionDiscriminator = [ /** * Creates a _UpdateMetadataCollectionNft_ instruction. * + * Optional accounts that are not provided default to the program ID since + * this was indicated in the IDL from which this instruction was generated. + * * @param accounts that will be accessed while the instruction is processed * @param args to provide as instruction data to the program * @@ -119,7 +110,7 @@ export function createUpdateMetadataCollectionNftInstruction( }); const keys: web3.AccountMeta[] = [ { - pubkey: accounts.oldMetadataAcct, + pubkey: accounts.metadataBuffer ?? programId, isWritable: false, isSigner: false, }, @@ -149,7 +140,7 @@ export function createUpdateMetadataCollectionNftInstruction( isSigner: false, }, { - pubkey: accounts.collectionAuthorityRecordPda, + pubkey: accounts.collectionAuthorityRecordPda ?? programId, isWritable: false, isSigner: false, }, diff --git a/clients/js-solita/src/generated/types/LeafSchema.ts b/clients/js-solita/src/generated/types/LeafSchema.ts index 79d324e4..f52a4c79 100644 --- a/clients/js-solita/src/generated/types/LeafSchema.ts +++ b/clients/js-solita/src/generated/types/LeafSchema.ts @@ -63,4 +63,4 @@ export const leafSchemaBeet = beet.dataEnum([ 'LeafSchemaRecord["V1"]', ), ], -]) as beet.FixableBeet; +]) as beet.FixableBeet; diff --git a/clients/js-solita/src/generated/types/UpdateArgs.ts b/clients/js-solita/src/generated/types/UpdateArgs.ts new file mode 100644 index 00000000..66624959 --- /dev/null +++ b/clients/js-solita/src/generated/types/UpdateArgs.ts @@ -0,0 +1,35 @@ +/** + * 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 { Creator, creatorBeet } from './Creator'; +export type UpdateArgs = { + name: beet.COption; + symbol: beet.COption; + uri: beet.COption; + creators: beet.COption; + sellerFeeBasisPoints: beet.COption; + primarySaleHappened: beet.COption; + isMutable: beet.COption; +}; + +/** + * @category userTypes + * @category generated + */ +export const updateArgsBeet = new beet.FixableBeetArgsStruct( + [ + ['name', beet.coption(beet.utf8String)], + ['symbol', beet.coption(beet.utf8String)], + ['uri', beet.coption(beet.utf8String)], + ['creators', beet.coption(beet.array(creatorBeet))], + ['sellerFeeBasisPoints', beet.coption(beet.u16)], + ['primarySaleHappened', beet.coption(beet.bool)], + ['isMutable', beet.coption(beet.bool)], + ], + 'UpdateArgs', +); diff --git a/clients/js-solita/src/generated/types/index.ts b/clients/js-solita/src/generated/types/index.ts index d89ada2e..d57211ea 100644 --- a/clients/js-solita/src/generated/types/index.ts +++ b/clients/js-solita/src/generated/types/index.ts @@ -7,6 +7,7 @@ export * from './LeafSchema'; export * from './MetadataArgs'; export * from './TokenProgramVersion'; export * from './TokenStandard'; +export * from './UpdateArgs'; export * from './UseMethod'; export * from './Uses'; export * from './Version'; diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index 3786ac44..52f4254c 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -286,9 +286,18 @@ describe('Bubblegum tests', () => { merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); }); it('Simple update', async () => { + const updateArgs = { + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + creators: null, + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, + }; const updateMetadataIx = createUpdateMetadataInstruction( { - oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + metadataBuffer: BUBBLEGUM_PROGRAM_ID, treeAuthority, treeDelegate: payer, leafOwner: payer, @@ -303,14 +312,8 @@ describe('Bubblegum tests', () => { root: Array.from(merkleAccount.getCurrentRoot()), nonce: 0, index: 0, - oldMetadata: originalCompressedNFT, - newName: 'NewName', - newSymbol: 'NewSymbol', - newUri: 'https://foobar.com', - newCreators: null, - newSellerFeeBasisPoints: null, - newPrimarySaleHappened: null, - newIsMutable: null, + currentMetadata: originalCompressedNFT, + updateArgs: updateArgs, }, ); @@ -328,9 +331,19 @@ describe('Bubblegum tests', () => { await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, newMetadataArgs); }); it('Cannot verify currently un-verified creator', async () => { + const updateArgs = { + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + // Attempt to verify all creators, even though some are not verified + creators: creators.map(c => ({ ...c, verified: true })), + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, + }; const updateMetadataIx = createUpdateMetadataInstruction( { - oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + metadataBuffer: BUBBLEGUM_PROGRAM_ID, treeAuthority, treeDelegate: payer, leafOwner: payer, @@ -345,15 +358,8 @@ describe('Bubblegum tests', () => { root: Array.from(merkleAccount.getCurrentRoot()), nonce: 0, index: 0, - oldMetadata: originalCompressedNFT, - newName: 'NewName', - newSymbol: 'NewSymbol', - newUri: 'https://foobar.com', - // Attempt to verify all creators, even though some are not verified - newCreators: creators.map(c => ({ ...c, verified: true })), - newSellerFeeBasisPoints: null, - newPrimarySaleHappened: null, - newIsMutable: null, + currentMetadata: originalCompressedNFT, + updateArgs: updateArgs, }, ); @@ -407,10 +413,20 @@ describe('Bubblegum tests', () => { // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree // Thus we must alter the MetadataArgs object we expect to exist in the leaf before the update to match - const oldMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } + const currentMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } + + const updateArgs = { + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + creators: null, + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, + }; const updateMetadataIx = createUpdateMetadataCollectionNftInstruction( { - oldMetadataAcct: BUBBLEGUM_PROGRAM_ID, + metadataBuffer: BUBBLEGUM_PROGRAM_ID, collectionAuthority: payer, collectionMint: collection.mintAddress, collectionMetadata: collection.metadataAddress, @@ -429,14 +445,8 @@ describe('Bubblegum tests', () => { root: Array.from(merkleAccount.getCurrentRoot()), nonce: 1, index: 1, - oldMetadata: oldMetadataArgs, - newName: 'NewName', - newSymbol: 'NewSymbol', - newUri: 'https://foobar.com', - newCreators: null, - newSellerFeeBasisPoints: null, - newPrimarySaleHappened: null, - newIsMutable: null, + currentMetadata: currentMetadataArgs, + updateArgs: updateArgs, }, ); @@ -448,7 +458,7 @@ describe('Bubblegum tests', () => { console.log("Update metadata tx success:", updateMetadataTxId) - const newMetadataArgs: MetadataArgs = { ...oldMetadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; + const newMetadataArgs: MetadataArgs = { ...currentMetadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; // We should now be able to verify the new leaf with the metadata replaced await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); diff --git a/clients/js-solita/yarn.lock b/clients/js-solita/yarn.lock index 1f00bfcb..2ca153ce 100644 --- a/clients/js-solita/yarn.lock +++ b/clients/js-solita/yarn.lock @@ -1233,12 +1233,17 @@ dependencies: "@noble/hashes" "1.3.2" +"@noble/ed25519@^1.6.1", "@noble/ed25519@^1.7.1": + version "1.7.3" + resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.3.tgz#57e1677bf6885354b466c38e2b620c62f45a7123" + integrity sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ== + "@noble/ed25519@^1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.1.tgz#6899660f6fbb97798a6fbd227227c4589a454724" integrity sha512-Rk4SkJFaXZiznFyC/t77Q0NKS4FL7TLJJsVG2V2oiEq3kJVeTdxysEe/yRWSpnWMe808XRDJ+VFh5pt/FN5plw== -"@noble/hashes@1.3.2", "@noble/hashes@^1.3.1": +"@noble/hashes@1.3.2", "@noble/hashes@^1.1.3", "@noble/hashes@^1.3.1": version "1.3.2" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== @@ -1413,6 +1418,24 @@ "@solana/buffer-layout-utils" "^0.2.0" buffer "^6.0.3" +"@solana/wallet-adapter-base@^0.9.2": + version "0.9.23" + resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.23.tgz#3b17c28afd44e173f44f658bf9700fd637e12a11" + integrity sha512-apqMuYwFp1jFi55NxDfvXUX2x1T0Zh07MxhZ/nCCTGys5raSfYUh82zen2BLv8BSDj/JxZ2P/s7jrQZGrX8uAw== + dependencies: + "@solana/wallet-standard-features" "^1.1.0" + "@wallet-standard/base" "^1.0.1" + "@wallet-standard/features" "^1.0.3" + eventemitter3 "^4.0.7" + +"@solana/wallet-standard-features@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@solana/wallet-standard-features/-/wallet-standard-features-1.1.0.tgz#516d78626dd0802d299db49298e4ebbec3433940" + integrity sha512-oVyygxfYkkF5INYL0GuD8GFmNO/wd45zNesIqGCFE6X66BYxmI6HmyzQJCcZTZ0BNsezlVg4t+3MCL5AhfFoGA== + dependencies: + "@wallet-standard/base" "^1.0.1" + "@wallet-standard/features" "^1.0.3" + "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.50.1", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.66.2": version "1.69.0" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.69.0.tgz#1756b1a26087172291c0b5163d3b44d24eef8aa7" @@ -1434,6 +1457,27 @@ rpc-websockets "^7.5.0" superstruct "^0.14.2" +"@solana/web3.js@^1.36.0": + version "1.78.5" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.78.5.tgz#591cd47423cdb0b5e5cb7e8dc4dc70b2abe02f80" + integrity sha512-2ZHsDNqkKdglJQrIvJ3p2DmgS3cGnary3VJyqt9C1SPrpAtLYzcElr3xyXJOznyQTU/8AMw+GoF11lFoKbicKg== + dependencies: + "@babel/runtime" "^7.22.6" + "@noble/curves" "^1.0.0" + "@noble/hashes" "^1.3.1" + "@solana/buffer-layout" "^4.0.0" + agentkeepalive "^4.3.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.0" + node-fetch "^2.6.12" + rpc-websockets "^7.5.1" + superstruct "^0.14.2" + "@solana/web3.js@^1.63.1": version "1.78.4" resolved "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.78.4.tgz#e8ca9abe4ec2af5fc540c1d272efee24aaffedb3" @@ -1455,6 +1499,11 @@ rpc-websockets "^7.5.1" superstruct "^0.14.2" +"@supercharge/promise-pool@^2.1.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@supercharge/promise-pool/-/promise-pool-2.4.0.tgz#6050eea8c2d7f92ddd4ddc582ee328b15c034ad3" + integrity sha512-O9CMipBlq5OObdt1uKJGIzm9cdjpPWfj+a+Zw9EgWKxaMNHKC7EU7X9taj3H0EGQNLOSq2jAcOa3EzxlfHsD6w== + "@types/babel__core@^7.1.14": version "7.1.20" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.20.tgz#e168cdd612c92a2d335029ed62ac94c95b362359" @@ -1771,6 +1820,11 @@ acorn@^8.8.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== + agentkeepalive@^4.3.0: version "4.5.0" resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" @@ -3665,7 +3719,14 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -ieee754@^1.2.1: +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -4965,13 +5026,18 @@ node-fetch@2.6.1: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== -node-fetch@^2.6.12: +node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" +node-gyp-build@^4.2.0: + version "4.6.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" + integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== + node-gyp-build@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" @@ -5466,6 +5532,11 @@ rpc-websockets@^7.5.1: bufferutil "^4.0.1" utf-8-validate "^5.0.2" +run-async@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" diff --git a/clients/js/src/generated/instructions/updateMetadata.ts b/clients/js/src/generated/instructions/updateMetadata.ts index 961afe9e..4ae459bd 100644 --- a/clients/js/src/generated/instructions/updateMetadata.ts +++ b/clients/js/src/generated/instructions/updateMetadata.ts @@ -21,13 +21,10 @@ import { import { Serializer, array, - bool, bytes, mapSerializer, option, - string, struct, - u16, u32, u64, u8, @@ -35,12 +32,12 @@ import { import { findTreeConfigPda } from '../accounts'; import { addAccountMeta, addObjectProperty } from '../shared'; import { - Creator, - CreatorArgs, MetadataArgs, MetadataArgsArgs, - getCreatorSerializer, + UpdateArgs, + UpdateArgsArgs, getMetadataArgsSerializer, + getUpdateArgsSerializer, } from '../types'; // Accounts. @@ -65,13 +62,7 @@ export type UpdateMetadataInstructionData = { nonce: bigint; index: number; currentMetadata: Option; - newName: Option; - newSymbol: Option; - newUri: Option; - newCreators: Option>; - newSellerFeeBasisPoints: Option; - newPrimarySaleHappened: Option; - newIsMutable: Option; + updateArgs: UpdateArgs; }; export type UpdateMetadataInstructionDataArgs = { @@ -79,13 +70,7 @@ export type UpdateMetadataInstructionDataArgs = { nonce: number | bigint; index: number; currentMetadata: OptionOrNullable; - newName: OptionOrNullable; - newSymbol: OptionOrNullable; - newUri: OptionOrNullable; - newCreators: OptionOrNullable>; - newSellerFeeBasisPoints: OptionOrNullable; - newPrimarySaleHappened: OptionOrNullable; - newIsMutable: OptionOrNullable; + updateArgs: UpdateArgsArgs; }; /** @deprecated Use `getUpdateMetadataInstructionDataSerializer()` without any argument instead. */ @@ -114,13 +99,7 @@ export function getUpdateMetadataInstructionDataSerializer( ['nonce', u64()], ['index', u32()], ['currentMetadata', option(getMetadataArgsSerializer())], - ['newName', option(string())], - ['newSymbol', option(string())], - ['newUri', option(string())], - ['newCreators', option(array(getCreatorSerializer()))], - ['newSellerFeeBasisPoints', option(u16())], - ['newPrimarySaleHappened', option(bool())], - ['newIsMutable', option(bool())], + ['updateArgs', getUpdateArgsSerializer()], ], { description: 'UpdateMetadataInstructionData' } ), diff --git a/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts b/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts index 7bd8531b..fdfc1770 100644 --- a/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts +++ b/clients/js/src/generated/instructions/updateMetadataCollectionNft.ts @@ -22,13 +22,10 @@ import { import { Serializer, array, - bool, bytes, mapSerializer, option, - string, struct, - u16, u32, u64, u8, @@ -36,12 +33,12 @@ import { import { findTreeConfigPda } from '../accounts'; import { addAccountMeta, addObjectProperty } from '../shared'; import { - Creator, - CreatorArgs, MetadataArgs, MetadataArgsArgs, - getCreatorSerializer, + UpdateArgs, + UpdateArgsArgs, getMetadataArgsSerializer, + getUpdateArgsSerializer, } from '../types'; // Accounts. @@ -70,13 +67,7 @@ export type UpdateMetadataCollectionNftInstructionData = { nonce: bigint; index: number; currentMetadata: Option; - newName: Option; - newSymbol: Option; - newUri: Option; - newCreators: Option>; - newSellerFeeBasisPoints: Option; - newPrimarySaleHappened: Option; - newIsMutable: Option; + updateArgs: UpdateArgs; }; export type UpdateMetadataCollectionNftInstructionDataArgs = { @@ -84,13 +75,7 @@ export type UpdateMetadataCollectionNftInstructionDataArgs = { nonce: number | bigint; index: number; currentMetadata: OptionOrNullable; - newName: OptionOrNullable; - newSymbol: OptionOrNullable; - newUri: OptionOrNullable; - newCreators: OptionOrNullable>; - newSellerFeeBasisPoints: OptionOrNullable; - newPrimarySaleHappened: OptionOrNullable; - newIsMutable: OptionOrNullable; + updateArgs: UpdateArgsArgs; }; /** @deprecated Use `getUpdateMetadataCollectionNftInstructionDataSerializer()` without any argument instead. */ @@ -122,13 +107,7 @@ export function getUpdateMetadataCollectionNftInstructionDataSerializer( ['nonce', u64()], ['index', u32()], ['currentMetadata', option(getMetadataArgsSerializer())], - ['newName', option(string())], - ['newSymbol', option(string())], - ['newUri', option(string())], - ['newCreators', option(array(getCreatorSerializer()))], - ['newSellerFeeBasisPoints', option(u16())], - ['newPrimarySaleHappened', option(bool())], - ['newIsMutable', option(bool())], + ['updateArgs', getUpdateArgsSerializer()], ], { description: 'UpdateMetadataCollectionNftInstructionData' } ), diff --git a/clients/js/src/generated/types/index.ts b/clients/js/src/generated/types/index.ts index c1dfbb76..8dc739ff 100644 --- a/clients/js/src/generated/types/index.ts +++ b/clients/js/src/generated/types/index.ts @@ -18,6 +18,7 @@ export * from './leafSchema'; export * from './metadataArgs'; export * from './tokenProgramVersion'; export * from './tokenStandard'; +export * from './updateArgs'; export * from './useMethod'; export * from './uses'; export * from './version'; diff --git a/clients/js/src/generated/types/updateArgs.ts b/clients/js/src/generated/types/updateArgs.ts new file mode 100644 index 00000000..f8dcc67a --- /dev/null +++ b/clients/js/src/generated/types/updateArgs.ts @@ -0,0 +1,64 @@ +/** + * 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 { Option, OptionOrNullable } from '@metaplex-foundation/umi'; +import { + Serializer, + array, + bool, + option, + string, + struct, + u16, +} from '@metaplex-foundation/umi/serializers'; +import { Creator, CreatorArgs, getCreatorSerializer } from '.'; + +export type UpdateArgs = { + name: Option; + symbol: Option; + uri: Option; + creators: Option>; + sellerFeeBasisPoints: Option; + primarySaleHappened: Option; + isMutable: Option; +}; + +export type UpdateArgsArgs = { + name: OptionOrNullable; + symbol: OptionOrNullable; + uri: OptionOrNullable; + creators: OptionOrNullable>; + sellerFeeBasisPoints: OptionOrNullable; + primarySaleHappened: OptionOrNullable; + isMutable: OptionOrNullable; +}; + +/** @deprecated Use `getUpdateArgsSerializer()` without any argument instead. */ +export function getUpdateArgsSerializer( + _context: object +): Serializer; +export function getUpdateArgsSerializer(): Serializer< + UpdateArgsArgs, + UpdateArgs +>; +export function getUpdateArgsSerializer( + _context: object = {} +): Serializer { + return struct( + [ + ['name', option(string())], + ['symbol', option(string())], + ['uri', option(string())], + ['creators', option(array(getCreatorSerializer()))], + ['sellerFeeBasisPoints', option(u16())], + ['primarySaleHappened', option(bool())], + ['isMutable', option(bool())], + ], + { description: 'UpdateArgs' } + ) as Serializer; +} diff --git a/idls/bubblegum.json b/idls/bubblegum.json index 5a5e341c..c46d521c 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -1170,49 +1170,9 @@ } }, { - "name": "newName", + "name": "updateArgs", "type": { - "option": "string" - } - }, - { - "name": "newSymbol", - "type": { - "option": "string" - } - }, - { - "name": "newUri", - "type": { - "option": "string" - } - }, - { - "name": "newCreators", - "type": { - "option": { - "vec": { - "defined": "Creator" - } - } - } - }, - { - "name": "newSellerFeeBasisPoints", - "type": { - "option": "u16" - } - }, - { - "name": "newPrimarySaleHappened", - "type": { - "option": "bool" - } - }, - { - "name": "newIsMutable", - "type": { - "option": "bool" + "defined": "UpdateArgs" } } ] @@ -1325,49 +1285,9 @@ } }, { - "name": "newName", - "type": { - "option": "string" - } - }, - { - "name": "newSymbol", + "name": "updateArgs", "type": { - "option": "string" - } - }, - { - "name": "newUri", - "type": { - "option": "string" - } - }, - { - "name": "newCreators", - "type": { - "option": { - "vec": { - "defined": "Creator" - } - } - } - }, - { - "name": "newSellerFeeBasisPoints", - "type": { - "option": "u16" - } - }, - { - "name": "newPrimarySaleHappened", - "type": { - "option": "bool" - } - }, - { - "name": "newIsMutable", - "type": { - "option": "bool" + "defined": "UpdateArgs" } } ] @@ -1900,6 +1820,60 @@ ] } }, + { + "name": "UpdateArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "name", + "type": { + "option": "string" + } + }, + { + "name": "symbol", + "type": { + "option": "string" + } + }, + { + "name": "uri", + "type": { + "option": "string" + } + }, + { + "name": "creators", + "type": { + "option": { + "vec": { + "defined": "Creator" + } + } + } + }, + { + "name": "sellerFeeBasisPoints", + "type": { + "option": "u16" + } + }, + { + "name": "primarySaleHappened", + "type": { + "option": "bool" + } + }, + { + "name": "isMutable", + "type": { + "option": "bool" + } + } + ] + } + }, { "name": "Version", "type": { diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index c1dd8f69..9fb21ec7 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -5,7 +5,9 @@ use crate::{ error::{metadata_error_into_bubblegum, BubblegumError}, state::{ leaf_schema::LeafSchema, - metaplex_adapter::{self, Collection, Creator, MetadataArgs, TokenProgramVersion}, + metaplex_adapter::{ + self, Collection, Creator, MetadataArgs, TokenProgramVersion, UpdateArgs, + }, metaplex_anchor::{MasterEdition, MplTokenMetadata, TokenMetadata}, DecompressableState, TreeConfig, Voucher, ASSET_PREFIX, COLLECTION_CPI_PREFIX, TREE_AUTHORITY_SIZE, VOUCHER_PREFIX, VOUCHER_SIZE, @@ -1040,13 +1042,7 @@ fn process_update_metadata<'info>( remaining_accounts: &[AccountInfo<'info>], root: [u8; 32], current_metadata: MetadataArgs, - new_name: Option, - new_symbol: Option, - new_uri: Option, - new_creators: Option>, - new_seller_fee_basis_points: Option, - new_primary_sale_happened: Option, - new_is_mutable: Option, + update_args: UpdateArgs, nonce: u64, index: u32, ) -> Result<()> { @@ -1061,16 +1057,16 @@ fn process_update_metadata<'info>( // Update metadata let mut updated_metadata = current_metadata; - if let Some(name) = new_name { + if let Some(name) = update_args.name { updated_metadata.name = name; }; - if let Some(symbol) = new_symbol { + if let Some(symbol) = update_args.symbol { updated_metadata.symbol = symbol; }; - if let Some(uri) = new_uri { + if let Some(uri) = update_args.uri { updated_metadata.uri = uri; }; - if let Some(creators) = new_creators { + if let Some(creators) = update_args.creators { let old_creators = updated_metadata.creators; let no_new_creators_were_verified = creators .iter() @@ -1086,10 +1082,10 @@ fn process_update_metadata<'info>( ); updated_metadata.creators = creators; } - if let Some(seller_fee_basis_points) = new_seller_fee_basis_points { + if let Some(seller_fee_basis_points) = update_args.seller_fee_basis_points { updated_metadata.seller_fee_basis_points = seller_fee_basis_points }; - if let Some(primary_sale_happened) = new_primary_sale_happened { + if let Some(primary_sale_happened) = update_args.primary_sale_happened { // a new value of primary_sale_happened should only be specified if primary_sale_happened was false in the original metadata require!( !updated_metadata.primary_sale_happened, @@ -1097,7 +1093,7 @@ fn process_update_metadata<'info>( ); updated_metadata.primary_sale_happened = primary_sale_happened; }; - if let Some(is_mutable) = new_is_mutable { + if let Some(is_mutable) = update_args.is_mutable { updated_metadata.is_mutable = is_mutable; }; @@ -1606,13 +1602,7 @@ pub mod bubblegum { nonce: u64, index: u32, current_metadata: Option, - new_name: Option, - new_symbol: Option, - new_uri: Option, - new_creators: Option>, - new_seller_fee_basis_points: Option, - new_primary_sale_happened: Option, - new_is_mutable: Option, + update_args: UpdateArgs, ) -> Result<()> { assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; @@ -1638,13 +1628,7 @@ pub mod bubblegum { ctx.remaining_accounts, root, current_metadata, - new_name, - new_symbol, - new_uri, - new_creators, - new_seller_fee_basis_points, - new_primary_sale_happened, - new_is_mutable, + update_args, nonce, index, ) @@ -1656,13 +1640,7 @@ pub mod bubblegum { nonce: u64, index: u32, current_metadata: Option, - new_name: Option, - new_symbol: Option, - new_uri: Option, - new_creators: Option>, - new_seller_fee_basis_points: Option, - new_primary_sale_happened: Option, - new_is_mutable: Option, + update_args: UpdateArgs, ) -> Result<()> { assert_signed_by_tree_delegate(&ctx.accounts.tree_authority, &ctx.accounts.tree_delegate)?; @@ -1698,13 +1676,7 @@ pub mod bubblegum { ctx.remaining_accounts, root, current_metadata, - new_name, - new_symbol, - new_uri, - new_creators, - new_seller_fee_basis_points, - new_primary_sale_happened, - new_is_mutable, + update_args, nonce, index, ) diff --git a/programs/bubblegum/program/src/state/metaplex_adapter.rs b/programs/bubblegum/program/src/state/metaplex_adapter.rs index 6023f435..d9ae15b9 100644 --- a/programs/bubblegum/program/src/state/metaplex_adapter.rs +++ b/programs/bubblegum/program/src/state/metaplex_adapter.rs @@ -102,3 +102,14 @@ pub struct MetadataArgs { pub token_program_version: TokenProgramVersion, pub creators: Vec, } + +#[derive(AnchorSerialize, AnchorDeserialize, PartialEq, Eq, Debug, Clone)] +pub struct UpdateArgs { + pub name: Option, + pub symbol: Option, + pub uri: Option, + pub creators: Option>, + pub seller_fee_basis_points: Option, + pub primary_sale_happened: Option, + pub is_mutable: Option, +} From 01733050353642cc2b1360272996a0bd46f27424 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:54:43 -0700 Subject: [PATCH 15/17] Prevent existing verified creators from being removed Exception: allow verification/unverification during metadata update for the signer of the tx. --- clients/js-solita/package.json | 2 +- clients/js-solita/tests/main.test.ts | 684 ++++++++++++++---- .../js/src/generated/errors/mplBubblegum.ts | 13 + idls/bubblegum.json | 5 + programs/bubblegum/program/src/error.rs | 2 + programs/bubblegum/program/src/lib.rs | 49 +- 6 files changed, 609 insertions(+), 146 deletions(-) diff --git a/clients/js-solita/package.json b/clients/js-solita/package.json index 6c7cc9b6..5efbb836 100644 --- a/clients/js-solita/package.json +++ b/clients/js-solita/package.json @@ -17,7 +17,7 @@ "run-tests": "jest tests --detectOpenHandles", "test": "start-server-and-test start-validator http://localhost:8899/health run-tests", "api:gen": "DEBUG='(solita|rustbin):(info|error)' solita", - "lint": "eslint \"{src,test}/**/*.ts\" --format stylish", + "lint": "eslint \"{src,tests}/**/*.ts\" --format stylish", "fix:lint": "yarn lint --fix", "prettier": "prettier \"{src,test}/**/*.ts\" --check", "fix:prettier": "prettier --write src/", diff --git a/clients/js-solita/tests/main.test.ts b/clients/js-solita/tests/main.test.ts index 52f4254c..85b38263 100644 --- a/clients/js-solita/tests/main.test.ts +++ b/clients/js-solita/tests/main.test.ts @@ -15,7 +15,7 @@ import { ConcurrentMerkleTreeAccount, SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, SPL_NOOP_PROGRAM_ID, - ValidDepthSizePair + ValidDepthSizePair, } from '@solana/spl-account-compression'; import { @@ -26,6 +26,7 @@ import { createRedeemInstruction, createDecompressV1Instruction, createUpdateMetadataInstruction, + createVerifyCreatorInstruction, MetadataArgs, PROGRAM_ID as BUBBLEGUM_PROGRAM_ID, TokenProgramVersion, @@ -34,20 +35,20 @@ import { createMintToCollectionV1Instruction, createUpdateMetadataCollectionNftInstruction, } from '../src/generated'; -import { getLeafAssetId, computeDataHash, computeCreatorHash, computeCompressedNFTHash } from '../src/mpl-bubblegum'; -import { BN } from 'bn.js'; -import { PROGRAM_ID as TOKEN_METADATA_PROGRAM_ID } from "@metaplex-foundation/mpl-token-metadata"; import { - ASSOCIATED_TOKEN_PROGRAM_ID, - TOKEN_PROGRAM_ID -} from "@solana/spl-token"; + getLeafAssetId, + computeDataHash, + computeCreatorHash, + computeCompressedNFTHash, +} from '../src/mpl-bubblegum'; +import { BN } from 'bn.js'; +import { PROGRAM_ID as TOKEN_METADATA_PROGRAM_ID } from '@metaplex-foundation/mpl-token-metadata'; +import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'; import { assert } from 'chai'; -import { Metaplex, keypairIdentity, CreateCompressedNftOutput } from "@metaplex-foundation/js"; +import { Metaplex, keypairIdentity, CreateCompressedNftOutput } from '@metaplex-foundation/js'; function keypairFromSeed(seed: string) { - const expandedSeed = Uint8Array.from( - Buffer.from(`${seed}`), - ); + const expandedSeed = Uint8Array.from(Buffer.from(`${seed}`)); return Keypair.fromSeed(expandedSeed.slice(0, 32)); } @@ -68,8 +69,14 @@ function makeCompressedNFT(name: string, symbol: string, creators: Creator[] = [ }; } -async function setupCertifiedCollection(connection: Connection, name: string, symbol: string, uri: string, updateAuthority: Keypair): Promise { - const metaplex = Metaplex.make(connection).use(keypairIdentity(updateAuthority)) +async function setupCertifiedCollection( + connection: Connection, + name: string, + symbol: string, + uri: string, + updateAuthority: Keypair, +): Promise { + const metaplex = Metaplex.make(connection).use(keypairIdentity(updateAuthority)); const collectionInfo = await metaplex.nfts().create({ uri, name, @@ -77,15 +84,21 @@ async function setupCertifiedCollection(connection: Connection, name: string, sy updateAuthority, tokenOwner: updateAuthority.publicKey, symbol, - creators: [{address: updateAuthority.publicKey, share: 100, authority: updateAuthority}], + creators: [{ address: updateAuthority.publicKey, share: 100, authority: updateAuthority }], isMutable: true, primarySaleHappened: false, isCollection: true, }); - return collectionInfo + return collectionInfo; } -function makeCompressedCollectionNFT(name: string, symbol: string, uri: string, collection: PublicKey, creators: Creator[] = []): MetadataArgs { +function makeCompressedCollectionNFT( + name: string, + symbol: string, + uri: string, + collection: PublicKey, + creators: Creator[] = [], +): MetadataArgs { return { name: name, symbol: symbol, @@ -108,8 +121,8 @@ async function setupTreeWithCompressedNFT( compressedNFT: MetadataArgs, depthSizePair: ValidDepthSizePair = { maxDepth: 14, - maxBufferSize: 64 - } + maxBufferSize: 64, + }, ): Promise<{ merkleTree: PublicKey; }> { @@ -117,7 +130,11 @@ async function setupTreeWithCompressedNFT( const merkleTreeKeypair = Keypair.generate(); const merkleTree = merkleTreeKeypair.publicKey; - const space = getConcurrentMerkleTreeAccountSize(depthSizePair.maxDepth, depthSizePair.maxBufferSize, depthSizePair.maxDepth); + const space = getConcurrentMerkleTreeAccountSize( + depthSizePair.maxDepth, + depthSizePair.maxBufferSize, + depthSizePair.maxDepth, + ); const allocTreeIx = SystemProgram.createAccount({ fromPubkey: payer, newAccountPubkey: merkleTree, @@ -181,23 +198,20 @@ async function verifyLeaf( delegate: PublicKey, index: number, merkleTree: PublicKey, - metadata: MetadataArgs -): Promise<{success: boolean}> { + metadata: MetadataArgs, +): Promise<{ success: boolean }> { const accountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const account = ConcurrentMerkleTreeAccount.fromBuffer(accountInfo!.data!); // Verify leaf exists. const leafIndex = new BN.BN(index); const assetId = await getLeafAssetId(merkleTree, leafIndex); - const verifyLeafIx = createVerifyLeafIx( - merkleTree, - { - root: account.getCurrentRoot(), - leaf: computeCompressedNFTHash(assetId, owner, delegate, leafIndex, metadata), - leafIndex: index, - proof: [], - } - ); + const verifyLeafIx = createVerifyLeafIx(merkleTree, { + root: account.getCurrentRoot(), + leaf: computeCompressedNFTHash(assetId, owner, delegate, leafIndex, metadata), + leafIndex: index, + proof: [], + }); const tx = new Transaction().add(verifyLeafIx); const txId = await sendAndConfirmTransaction(connection, tx, [payerKeypair], { commitment: 'confirmed', @@ -205,8 +219,8 @@ async function verifyLeaf( }); console.log('Verified NFT existence:', txId); return { - success: true - } + success: true, + }; } describe('Bubblegum tests', () => { @@ -215,9 +229,13 @@ describe('Bubblegum tests', () => { const payer = payerKeypair.publicKey; beforeEach(async () => { - const airdropSig = await connection.requestAirdrop(payer, 10*LAMPORTS_PER_SOL); + const airdropSig = await connection.requestAirdrop(payer, 10 * LAMPORTS_PER_SOL); const latestBlockhash = await connection.getLatestBlockhash(); - await connection.confirmTransaction({blockhash: latestBlockhash.blockhash, lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, signature: airdropSig}); + await connection.confirmTransaction({ + blockhash: latestBlockhash.blockhash, + lastValidBlockHeight: latestBlockhash.lastValidBlockHeight, + signature: airdropSig, + }); }); it('Can create a Bubblegum tree and mint to it', async () => { const compressedNFT: MetadataArgs = { @@ -234,19 +252,23 @@ describe('Bubblegum tests', () => { sellerFeeBasisPoints: 0, isMutable: false, }; - await setupTreeWithCompressedNFT(connection, payerKeypair, compressedNFT, { maxDepth: 14, maxBufferSize: 64 }); + await setupTreeWithCompressedNFT(connection, payerKeypair, compressedNFT, { + maxDepth: 14, + maxBufferSize: 64, + }); }); describe('Unit test compressed NFT instructions', () => { const MAX_DEPTH = 14; - let creators: Creator[] = [ + const secondCreator = new Keypair(); + const creators: Creator[] = [ { address: payer, share: 55, verified: false, }, { - address: new Keypair().publicKey, + address: secondCreator.publicKey, share: 45, verified: false, }, @@ -261,17 +283,25 @@ describe('Bubblegum tests', () => { { maxDepth: MAX_DEPTH, maxBufferSize: 64, - } + }, ); merkleTree = result.merkleTree; }); it('Can verify existence of a compressed NFT', async () => { - const result = await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, originalCompressedNFT); - assert(result.success, "Failed to verify leaf"); + const result = await verifyLeaf( + connection, + payerKeypair, + payerKeypair.publicKey, + payerKeypair.publicKey, + 0, + merkleTree, + originalCompressedNFT, + ); + assert(result.success, 'Failed to verify leaf'); }); - describe("Update metadata", () => { + describe('Update metadata', () => { let treeAuthority: PublicKey; beforeEach(async () => { [treeAuthority] = PublicKey.findProgramAddressSync( @@ -279,21 +309,23 @@ describe('Bubblegum tests', () => { BUBBLEGUM_PROGRAM_ID, ); }); - describe("Not linked to collection", () => { + describe('Not linked to collection', () => { let merkleAccount: ConcurrentMerkleTreeAccount; beforeEach(async () => { - const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { + commitment: 'confirmed', + }); merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); }); it('Simple update', async () => { const updateArgs = { - name: 'NewName', - symbol: 'NewSymbol', - uri: 'https://foobar.com', - creators: null, - sellerFeeBasisPoints: null, - primarySaleHappened: null, - isMutable: null, + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + creators: null, + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, }; const updateMetadataIx = createUpdateMetadataInstruction( { @@ -306,7 +338,7 @@ describe('Bubblegum tests', () => { merkleTree, logWrapper: SPL_NOOP_PROGRAM_ID, compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, }, { root: Array.from(merkleAccount.getCurrentRoot()), @@ -316,27 +348,119 @@ describe('Bubblegum tests', () => { updateArgs: updateArgs, }, ); - + const updateMetadataTx = new Transaction().add(updateMetadataIx); - const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); - - console.log("Update metadata tx success:", updateMetadataTxId) - - const newMetadataArgs: MetadataArgs = { ...originalCompressedNFT, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; - + const updateMetadataTxId = await sendAndConfirmTransaction( + connection, + updateMetadataTx, + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('Update metadata tx success:', updateMetadataTxId); + + const newMetadataArgs: MetadataArgs = { + ...originalCompressedNFT, + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + }; + // We should now be able to verify the new leaf with the metadata replaced - await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 0, merkleTree, newMetadataArgs); + await verifyLeaf( + connection, + payerKeypair, + payerKeypair.publicKey, + payerKeypair.publicKey, + 0, + merkleTree, + newMetadataArgs, + ); + }); + it('Cannot verify currently unverified creator if not signer', async () => { + // Attempt to verify second creator, should not work. + const updatedCreators: Creator[] = [ + { + address: payer, + share: 55, + verified: false, + }, + { + address: secondCreator.publicKey, + share: 45, + verified: true, + }, + ]; + const updateArgs = { + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + creators: updatedCreators, + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, + }; + const updateMetadataIx = createUpdateMetadataInstruction( + { + metadataBuffer: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 0, + index: 0, + currentMetadata: originalCompressedNFT, + updateArgs: updateArgs, + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + try { + await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { + commitment: 'confirmed', + skipPreflight: true, + }); + assert.fail( + 'Metadata update verifiying currently unverified creator if not signer should fail', + ); + } catch (err) { + assert( + err.message.includes('"Custom":6006'), + 'Did not fail for correct reason! ' + err.message, + ); + } }); - it('Cannot verify currently un-verified creator', async () => { + + it('Can verify currently unverified creator if signer', async () => { + // Attempt to verify payer, should work. + const updatedCreators: Creator[] = [ + { + address: payer, + share: 55, + verified: true, + }, + { + address: secondCreator.publicKey, + share: 45, + verified: false, + }, + ]; const updateArgs = { name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com', - // Attempt to verify all creators, even though some are not verified - creators: creators.map(c => ({ ...c, verified: true })), + creators: updatedCreators, sellerFeeBasisPoints: null, primarySaleHappened: null, isMutable: null, @@ -352,7 +476,7 @@ describe('Bubblegum tests', () => { merkleTree, logWrapper: SPL_NOOP_PROGRAM_ID, compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, }, { root: Array.from(merkleAccount.getCurrentRoot()), @@ -362,58 +486,311 @@ describe('Bubblegum tests', () => { updateArgs: updateArgs, }, ); - + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction( + connection, + updateMetadataTx, + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('Update metadata success, payer verified:', updateMetadataTxId); + }); + + it('Cannot unverify currently verified creator if not signer', async () => { + // Verify second creator. + await connection.requestAirdrop(secondCreator.publicKey, LAMPORTS_PER_SOL); + const verifyCreatorIx = createVerifyCreatorInstruction( + { + treeAuthority, + leafOwner: payer, + leafDelegate: payer, + merkleTree, + payer: secondCreator.publicKey, + creator: secondCreator.publicKey, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + dataHash: Array.from(computeDataHash(originalCompressedNFT)), + creatorHash: Array.from(computeCreatorHash(originalCompressedNFT.creators)), + nonce: 0, + index: 0, + message: originalCompressedNFT, + }, + ); + + const verifyCreatorTx = new Transaction().add(verifyCreatorIx); + verifyCreatorTx.feePayer = secondCreator.publicKey; + const verifyCreatorTxId = await sendAndConfirmTransaction( + connection, + verifyCreatorTx, + [secondCreator], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('NFT verify second creator Tx:', verifyCreatorTxId); + + // This is the state after previous creator verification. + const currentCreators: Creator[] = [ + { + address: payer, + share: 55, + verified: false, + }, + { + address: secondCreator.publicKey, + share: 45, + verified: true, + }, + ]; + const currentMetadata = makeCompressedNFT('test', 'TST', currentCreators); + + // Attempt to unverify second creator, should not work. + const updatedCreators: Creator[] = [ + { + address: payer, + share: 55, + verified: false, + }, + { + address: secondCreator.publicKey, + share: 45, + verified: false, + }, + ]; + const updateArgs = { + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + creators: updatedCreators, + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, + }; + const updateMetadataIx = createUpdateMetadataInstruction( + { + metadataBuffer: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 0, + index: 0, + currentMetadata, + updateArgs: updateArgs, + }, + ); + const updateMetadataTx = new Transaction().add(updateMetadataIx); try { await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { commitment: 'confirmed', skipPreflight: true, }); - assert.fail("Metadata update verifying previously unverified creators should fail") - } catch(err) { - assert(err.message.includes('\"Custom\":6006'), "Did not fail because creator did not verify!"); + assert.fail( + 'Metadata update unverifying currently verified creator if not signer should fail', + ); + } catch (err) { + assert( + err.message.includes('"Custom":6041'), + 'Did not fail for correct reason! ' + err.message, + ); } }); - }) + + it('Can unverify currently verified creator if signer', async () => { + // Verify payer. + const verifyCreatorIx = createVerifyCreatorInstruction( + { + treeAuthority, + leafOwner: payer, + leafDelegate: payer, + merkleTree, + payer, + creator: payer, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + dataHash: Array.from(computeDataHash(originalCompressedNFT)), + creatorHash: Array.from(computeCreatorHash(originalCompressedNFT.creators)), + nonce: 0, + index: 0, + message: originalCompressedNFT, + }, + ); + + const verifyCreatorTx = new Transaction().add(verifyCreatorIx); + verifyCreatorTx.feePayer = payer; + const verifyCreatorTxId = await sendAndConfirmTransaction( + connection, + verifyCreatorTx, + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('NFT verify first creator Tx:', verifyCreatorTxId); + + // This is the state after previous creator verification. + const currentCreators: Creator[] = [ + { + address: payer, + share: 55, + verified: true, + }, + { + address: secondCreator.publicKey, + share: 45, + verified: false, + }, + ]; + const currentMetadata = makeCompressedNFT('test', 'TST', currentCreators); + + // Attempt to unverify payer, should work. + const updatedCreators: Creator[] = [ + { + address: payer, + share: 55, + verified: false, + }, + { + address: secondCreator.publicKey, + share: 45, + verified: false, + }, + ]; + const updateArgs = { + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + creators: updatedCreators, + sellerFeeBasisPoints: null, + primarySaleHappened: null, + isMutable: null, + }; + const updateMetadataIx = createUpdateMetadataInstruction( + { + metadataBuffer: BUBBLEGUM_PROGRAM_ID, + treeAuthority, + treeDelegate: payer, + leafOwner: payer, + leafDelegate: payer, + payer, + merkleTree, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + root: Array.from(merkleAccount.getCurrentRoot()), + nonce: 0, + index: 0, + currentMetadata, + updateArgs: updateArgs, + }, + ); + + const updateMetadataTx = new Transaction().add(updateMetadataIx); + const updateMetadataTxId = await sendAndConfirmTransaction( + connection, + updateMetadataTx, + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('Update metadata success, payer unverified:', updateMetadataTxId); + }); + }); it('Linked to verified collection update', async () => { - const collection = await setupCertifiedCollection(connection, 'ColName', 'ColSymbol', 'https://mycollection.com', payerKeypair) - const [bubblegumSigner] = PublicKey.findProgramAddressSync([Buffer.from("collection_cpi")], BUBBLEGUM_PROGRAM_ID); - const metadataArgs = makeCompressedCollectionNFT("cname", "csymbol", "https://myuri.com", collection.mintAddress); - + const collection = await setupCertifiedCollection( + connection, + 'ColName', + 'ColSymbol', + 'https://mycollection.com', + payerKeypair, + ); + const [bubblegumSigner] = PublicKey.findProgramAddressSync( + [Buffer.from('collection_cpi')], + BUBBLEGUM_PROGRAM_ID, + ); + const metadataArgs = makeCompressedCollectionNFT( + 'cname', + 'csymbol', + 'https://myuri.com', + collection.mintAddress, + ); + // Mint a New NFT to a Collection - const mintToCollectionIx = createMintToCollectionV1Instruction({ - treeAuthority, - leafOwner: payer, - leafDelegate: payer, - merkleTree, - payer, - treeDelegate: payer, - collectionAuthority: payer, - collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, - collectionMint: collection.mintAddress, - collectionMetadata: collection.metadataAddress, - editionAccount: collection.masterEditionAddress, - bubblegumSigner, - logWrapper: SPL_NOOP_PROGRAM_ID, - compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, - }, { - metadataArgs: metadataArgs - }); - - const mintToCollectionTxId = await sendAndConfirmTransaction(connection, new Transaction().add(mintToCollectionIx), [payerKeypair], { + const mintToCollectionIx = createMintToCollectionV1Instruction( + { + treeAuthority, + leafOwner: payer, + leafDelegate: payer, + merkleTree, + payer, + treeDelegate: payer, + collectionAuthority: payer, + collectionAuthorityRecordPda: BUBBLEGUM_PROGRAM_ID, + collectionMint: collection.mintAddress, + collectionMetadata: collection.metadataAddress, + editionAccount: collection.masterEditionAddress, + bubblegumSigner, + logWrapper: SPL_NOOP_PROGRAM_ID, + compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + }, + { + metadataArgs: metadataArgs, + }, + ); + + const mintToCollectionTxId = await sendAndConfirmTransaction( + connection, + new Transaction().add(mintToCollectionIx), + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('Mint to Collection Success:', mintToCollectionTxId); + + const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed', - skipPreflight: true, }); - - console.log("Mint to Collection Success:", mintToCollectionTxId); - - const merkleAccountInfo = await connection.getAccountInfo(merkleTree, { commitment: 'confirmed' }); const merkleAccount = ConcurrentMerkleTreeAccount.fromBuffer(merkleAccountInfo!.data!); - + // MintToCollectionV1 will update verified to true in MetadataArgs before minting to the tree // Thus we must alter the MetadataArgs object we expect to exist in the leaf before the update to match - const currentMetadataArgs = {...metadataArgs, collection: {key: metadataArgs.collection!.key, verified: true} } + const currentMetadataArgs = { + ...metadataArgs, + collection: { key: metadataArgs.collection!.key, verified: true }, + }; const updateArgs = { name: 'NewName', @@ -439,7 +816,7 @@ describe('Bubblegum tests', () => { merkleTree, logWrapper: SPL_NOOP_PROGRAM_ID, compressionProgram: SPL_ACCOUNT_COMPRESSION_PROGRAM_ID, - tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, + tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID, }, { root: Array.from(merkleAccount.getCurrentRoot()), @@ -449,21 +826,39 @@ describe('Bubblegum tests', () => { updateArgs: updateArgs, }, ); - + const updateMetadataTx = new Transaction().add(updateMetadataIx); - const updateMetadataTxId = await sendAndConfirmTransaction(connection, updateMetadataTx, [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); - - console.log("Update metadata tx success:", updateMetadataTxId) - - const newMetadataArgs: MetadataArgs = { ...currentMetadataArgs, name: 'NewName', symbol: 'NewSymbol', uri: 'https://foobar.com'}; - + const updateMetadataTxId = await sendAndConfirmTransaction( + connection, + updateMetadataTx, + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); + + console.log('Update metadata tx success:', updateMetadataTxId); + + const newMetadataArgs: MetadataArgs = { + ...currentMetadataArgs, + name: 'NewName', + symbol: 'NewSymbol', + uri: 'https://foobar.com', + }; + // We should now be able to verify the new leaf with the metadata replaced - await verifyLeaf(connection, payerKeypair, payerKeypair.publicKey, payerKeypair.publicKey, 1, merkleTree, newMetadataArgs); + await verifyLeaf( + connection, + payerKeypair, + payerKeypair.publicKey, + payerKeypair.publicKey, + 1, + merkleTree, + newMetadataArgs, + ); }); - }) + }); it('Can transfer and burn a compressed NFT', async () => { // Transfer. @@ -491,7 +886,7 @@ describe('Bubblegum tests', () => { dataHash: Array.from(computeDataHash(originalCompressedNFT)), creatorHash: Array.from(computeCreatorHash(originalCompressedNFT.creators)), nonce: 0, - index: 0 + index: 0, }, ); @@ -519,16 +914,21 @@ describe('Bubblegum tests', () => { dataHash: Array.from(computeDataHash(originalCompressedNFT)), creatorHash: Array.from(computeCreatorHash(originalCompressedNFT.creators)), nonce: 0, - index: 0 + index: 0, }, ); const burnTx = new Transaction().add(burnIx); burnTx.feePayer = payer; - const burnTxId = await sendAndConfirmTransaction(connection, burnTx, [payerKeypair, newLeafOwnerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); + const burnTxId = await sendAndConfirmTransaction( + connection, + burnTx, + [payerKeypair, newLeafOwnerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); console.log('NFT burn tx:', burnTxId); }); @@ -543,7 +943,11 @@ describe('Bubblegum tests', () => { ); const nonce = new BN.BN(0); const [voucher] = PublicKey.findProgramAddressSync( - [Buffer.from('voucher', 'utf8'), merkleTree.toBuffer(), Uint8Array.from(nonce.toArray('le', 8))], + [ + Buffer.from('voucher', 'utf8'), + merkleTree.toBuffer(), + Uint8Array.from(nonce.toArray('le', 8)), + ], BUBBLEGUM_PROGRAM_ID, ); @@ -562,7 +966,7 @@ describe('Bubblegum tests', () => { dataHash: Array.from(computeDataHash(originalCompressedNFT)), creatorHash: Array.from(computeCreatorHash(originalCompressedNFT.creators)), nonce, - index: 0 + index: 0, }, ); @@ -577,7 +981,11 @@ describe('Bubblegum tests', () => { // Decompress. const [mint] = PublicKey.findProgramAddressSync( - [Buffer.from('asset', 'utf8'), merkleTree.toBuffer(), Uint8Array.from(nonce.toArray('le', 8))], + [ + Buffer.from('asset', 'utf8'), + merkleTree.toBuffer(), + Uint8Array.from(nonce.toArray('le', 8)), + ], BUBBLEGUM_PROGRAM_ID, ); const [tokenAccount] = PublicKey.findProgramAddressSync( @@ -586,14 +994,19 @@ describe('Bubblegum tests', () => { ); const [mintAuthority] = PublicKey.findProgramAddressSync( [mint.toBuffer()], - BUBBLEGUM_PROGRAM_ID + BUBBLEGUM_PROGRAM_ID, ); const [metadata] = PublicKey.findProgramAddressSync( [Buffer.from('metadata', 'utf8'), TOKEN_METADATA_PROGRAM_ID.toBuffer(), mint.toBuffer()], TOKEN_METADATA_PROGRAM_ID, ); const [masterEdition] = PublicKey.findProgramAddressSync( - [Buffer.from('metadata', 'utf8'), TOKEN_METADATA_PROGRAM_ID.toBuffer(), mint.toBuffer(), Buffer.from('edition', 'utf8')], + [ + Buffer.from('metadata', 'utf8'), + TOKEN_METADATA_PROGRAM_ID.toBuffer(), + mint.toBuffer(), + Buffer.from('edition', 'utf8'), + ], TOKEN_METADATA_PROGRAM_ID, ); @@ -612,18 +1025,23 @@ describe('Bubblegum tests', () => { logWrapper: SPL_NOOP_PROGRAM_ID, }, { - metadata: originalCompressedNFT + metadata: originalCompressedNFT, }, ); const decompressTx = new Transaction().add(decompressIx); decompressTx.feePayer = payer; - const decompressTxId = await sendAndConfirmTransaction(connection, decompressTx, [payerKeypair], { - commitment: 'confirmed', - skipPreflight: true, - }); + const decompressTxId = await sendAndConfirmTransaction( + connection, + decompressTx, + [payerKeypair], + { + commitment: 'confirmed', + skipPreflight: true, + }, + ); console.log('NFT decompress tx:', decompressTxId); }); - }) + }); }); diff --git a/clients/js/src/generated/errors/mplBubblegum.ts b/clients/js/src/generated/errors/mplBubblegum.ts index bdc10ee4..e2198337 100644 --- a/clients/js/src/generated/errors/mplBubblegum.ts +++ b/clients/js/src/generated/errors/mplBubblegum.ts @@ -588,6 +588,19 @@ nameToErrorMap.set( PrimarySaleCanOnlyBeFlippedToTrueError ); +/** CreatorDidNotUnverify: Creator did not unverify the metadata */ +export class CreatorDidNotUnverifyError extends ProgramError { + readonly name: string = 'CreatorDidNotUnverify'; + + readonly code: number = 0x1799; // 6041 + + constructor(program: Program, cause?: Error) { + super('Creator did not unverify the metadata', program, cause); + } +} +codeToErrorMap.set(0x1799, CreatorDidNotUnverifyError); +nameToErrorMap.set('CreatorDidNotUnverify', CreatorDidNotUnverifyError); + /** * Attempts to resolve a custom program error from the provided error code. * @category Errors diff --git a/idls/bubblegum.json b/idls/bubblegum.json index c46d521c..9eb03424 100644 --- a/idls/bubblegum.json +++ b/idls/bubblegum.json @@ -2282,6 +2282,11 @@ "code": 6040, "name": "PrimarySaleCanOnlyBeFlippedToTrue", "msg": "Can only update primary sale to true" + }, + { + "code": 6041, + "name": "CreatorDidNotUnverify", + "msg": "Creator did not unverify the metadata" } ], "metadata": { diff --git a/programs/bubblegum/program/src/error.rs b/programs/bubblegum/program/src/error.rs index d3d2208f..011b1019 100644 --- a/programs/bubblegum/program/src/error.rs +++ b/programs/bubblegum/program/src/error.rs @@ -86,6 +86,8 @@ pub enum BubblegumError { NFTNotLinkedToVerifiedCollection, #[msg("Can only update primary sale to true")] PrimarySaleCanOnlyBeFlippedToTrue, + #[msg("Creator did not unverify the metadata")] + CreatorDidNotUnverify, } // Converts certain Token Metadata errors into Bubblegum equivalents diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 9fb21ec7..2966f8af 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -1031,8 +1031,19 @@ fn assert_authority_matches_collection<'info>( Ok(()) } +fn all_verified_creators_in_a_are_in_b(a: &[Creator], b: &[Creator], exception: Pubkey) -> bool { + a.iter() + .filter(|creator_a| creator_a.verified) + .all(|creator_a| { + creator_a.address == exception + || b.iter() + .any(|creator_b| creator_a.address == creator_b.address && creator_b.verified) + }) +} + fn process_update_metadata<'info>( merkle_tree: &AccountInfo<'info>, + tree_delegate: &AccountInfo<'info>, owner: &AccountInfo<'info>, delegate: &AccountInfo<'info>, compression_program: &AccountInfo<'info>, @@ -1066,21 +1077,33 @@ fn process_update_metadata<'info>( if let Some(uri) = update_args.uri { updated_metadata.uri = uri; }; - if let Some(creators) = update_args.creators { - let old_creators = updated_metadata.creators; - let no_new_creators_were_verified = creators - .iter() - .filter(|c| c.verified) // select only creators that are verified - .all(|c| { - old_creators - .iter() - .any(|old| old.address == c.address && old.verified) - }); + if let Some(updated_creators) = update_args.creators { + let current_creators = updated_metadata.creators; + + // Make sure no new creator is verified (unless it is the tree delegate). + let no_new_creators_verified = all_verified_creators_in_a_are_in_b( + &updated_creators, + ¤t_creators, + tree_delegate.key(), + ); require!( - no_new_creators_were_verified, + no_new_creators_verified, BubblegumError::CreatorDidNotVerify ); - updated_metadata.creators = creators; + + // Make sure no current verified creator is unverified or removed (unless it is the tree + // delegate). + let no_current_creators_unverified = all_verified_creators_in_a_are_in_b( + ¤t_creators, + &updated_creators, + tree_delegate.key(), + ); + require!( + no_current_creators_unverified, + BubblegumError::CreatorDidNotUnverify + ); + + updated_metadata.creators = updated_creators; } if let Some(seller_fee_basis_points) = update_args.seller_fee_basis_points { updated_metadata.seller_fee_basis_points = seller_fee_basis_points @@ -1619,6 +1642,7 @@ pub mod bubblegum { process_update_metadata( &ctx.accounts.merkle_tree.to_account_info(), + &ctx.accounts.tree_delegate, &ctx.accounts.leaf_owner, &ctx.accounts.leaf_delegate, &ctx.accounts.compression_program.to_account_info(), @@ -1667,6 +1691,7 @@ pub mod bubblegum { process_update_metadata( &ctx.accounts.merkle_tree.to_account_info(), + &ctx.accounts.tree_delegate, &ctx.accounts.leaf_owner, &ctx.accounts.leaf_delegate, &ctx.accounts.compression_program.to_account_info(), From 367d3f33e81e159f01db130ed91d226dbc674de2 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:25:26 -0700 Subject: [PATCH 16/17] Derive Default on UpdateArgs --- programs/bubblegum/program/src/state/metaplex_adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/bubblegum/program/src/state/metaplex_adapter.rs b/programs/bubblegum/program/src/state/metaplex_adapter.rs index d9ae15b9..6524ad20 100644 --- a/programs/bubblegum/program/src/state/metaplex_adapter.rs +++ b/programs/bubblegum/program/src/state/metaplex_adapter.rs @@ -103,7 +103,7 @@ pub struct MetadataArgs { pub creators: Vec, } -#[derive(AnchorSerialize, AnchorDeserialize, PartialEq, Eq, Debug, Clone)] +#[derive(AnchorSerialize, AnchorDeserialize, PartialEq, Eq, Debug, Clone, Default)] pub struct UpdateArgs { pub name: Option, pub symbol: Option, From eb727503b1655775f98fe9904723b12122b3b481 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:07:09 -0700 Subject: [PATCH 17/17] Fix typo --- programs/bubblegum/program/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/bubblegum/program/src/lib.rs b/programs/bubblegum/program/src/lib.rs index 2966f8af..4bd5852c 100644 --- a/programs/bubblegum/program/src/lib.rs +++ b/programs/bubblegum/program/src/lib.rs @@ -220,7 +220,7 @@ pub struct Transfer<'info> { pub tree_authority: Account<'info, TreeConfig>, /// CHECK: This account is checked in the instruction pub leaf_owner: UncheckedAccount<'info>, - /// CHECK: This account is chekced in the instruction + /// CHECK: This account is checked in the instruction pub leaf_delegate: UncheckedAccount<'info>, /// CHECK: This account is neither written to nor read from. pub new_leaf_owner: UncheckedAccount<'info>, @@ -267,7 +267,7 @@ pub struct UpdateMetadata<'info> { pub tree_delegate: Signer<'info>, /// CHECK: This account is checked in the instruction pub leaf_owner: UncheckedAccount<'info>, - /// CHECK: This account is chekced in the instruction + /// CHECK: This account is checked in the instruction pub leaf_delegate: UncheckedAccount<'info>, pub payer: Signer<'info>, #[account(mut)] @@ -299,7 +299,7 @@ pub struct UpdateMetadataCollectionNFT<'info> { pub collection_authority_record_pda: Option>, /// CHECK: This account is checked in the instruction pub leaf_owner: UncheckedAccount<'info>, - /// CHECK: This account is chekced in the instruction + /// CHECK: This account is checked in the instruction pub leaf_delegate: UncheckedAccount<'info>, pub payer: Signer<'info>, #[account(mut)] @@ -328,7 +328,7 @@ pub struct Redeem<'info> { pub tree_authority: Account<'info, TreeConfig>, #[account(mut)] pub leaf_owner: Signer<'info>, - /// CHECK: This account is chekced in the instruction + /// CHECK: This account is checked in the instruction pub leaf_delegate: UncheckedAccount<'info>, #[account(mut)] /// CHECK: checked in cpi @@ -440,7 +440,7 @@ pub struct Compress<'info> { pub tree_authority: UncheckedAccount<'info>, /// CHECK: This account is checked in the instruction pub leaf_owner: Signer<'info>, - /// CHECK: This account is chekced in the instruction + /// CHECK: This account is checked in the instruction pub leaf_delegate: UncheckedAccount<'info>, /// CHECK: This account is not read pub merkle_tree: UncheckedAccount<'info>,