implemented more token_metadata wrappers (#2179)
This commit is contained in:
parent
e019ba2199
commit
2a07d841c6
|
@ -204,6 +204,74 @@ pub fn verify_collection<'info>(
|
|||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn verify_sized_collection_item<'info>(
|
||||
ctx: CpiContext<'_, '_, '_, 'info, VerifySizedCollectionItem<'info>>,
|
||||
collection_authority_record: Option<Pubkey>,
|
||||
) -> Result<()> {
|
||||
let ix = mpl_token_metadata::instruction::verify_sized_collection_item(
|
||||
ID,
|
||||
*ctx.accounts.metadata.key,
|
||||
*ctx.accounts.collection_authority.key,
|
||||
*ctx.accounts.payer.key,
|
||||
*ctx.accounts.collection_mint.key,
|
||||
*ctx.accounts.collection_metadata.key,
|
||||
*ctx.accounts.collection_master_edition.key,
|
||||
collection_authority_record,
|
||||
);
|
||||
solana_program::program::invoke_signed(
|
||||
&ix,
|
||||
&ToAccountInfos::to_account_infos(&ctx),
|
||||
ctx.signer_seeds,
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn set_and_verify_collection<'info>(
|
||||
ctx: CpiContext<'_, '_, '_, 'info, SetAndVerifyCollection<'info>>,
|
||||
collection_authority_record: Option<Pubkey>,
|
||||
) -> Result<()> {
|
||||
let ix = mpl_token_metadata::instruction::set_and_verify_collection(
|
||||
ID,
|
||||
*ctx.accounts.metadata.key,
|
||||
*ctx.accounts.collection_authority.key,
|
||||
*ctx.accounts.payer.key,
|
||||
*ctx.accounts.update_authority.key,
|
||||
*ctx.accounts.collection_mint.key,
|
||||
*ctx.accounts.collection_metadata.key,
|
||||
*ctx.accounts.collection_master_edition.key,
|
||||
collection_authority_record,
|
||||
);
|
||||
solana_program::program::invoke_signed(
|
||||
&ix,
|
||||
&ToAccountInfos::to_account_infos(&ctx),
|
||||
ctx.signer_seeds,
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn set_and_verify_sized_collection_item<'info>(
|
||||
ctx: CpiContext<'_, '_, '_, 'info, SetAndVerifySizedCollectionItem<'info>>,
|
||||
collection_authority_record: Option<Pubkey>,
|
||||
) -> Result<()> {
|
||||
let ix = mpl_token_metadata::instruction::set_and_verify_sized_collection_item(
|
||||
ID,
|
||||
*ctx.accounts.metadata.key,
|
||||
*ctx.accounts.collection_authority.key,
|
||||
*ctx.accounts.payer.key,
|
||||
*ctx.accounts.update_authority.key,
|
||||
*ctx.accounts.collection_mint.key,
|
||||
*ctx.accounts.collection_metadata.key,
|
||||
*ctx.accounts.collection_master_edition.key,
|
||||
collection_authority_record,
|
||||
);
|
||||
solana_program::program::invoke_signed(
|
||||
&ix,
|
||||
&ToAccountInfos::to_account_infos(&ctx),
|
||||
ctx.signer_seeds,
|
||||
)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub fn freeze_delegated_account<'info>(
|
||||
ctx: CpiContext<'_, '_, '_, 'info, FreezeDelegatedAccount<'info>>,
|
||||
) -> Result<()> {
|
||||
|
@ -375,6 +443,38 @@ pub struct VerifyCollection<'info> {
|
|||
pub collection_master_edition: AccountInfo<'info>,
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct VerifySizedCollectionItem<'info> {
|
||||
pub payer: AccountInfo<'info>,
|
||||
pub metadata: AccountInfo<'info>,
|
||||
pub collection_authority: AccountInfo<'info>,
|
||||
pub collection_mint: AccountInfo<'info>,
|
||||
pub collection_metadata: AccountInfo<'info>,
|
||||
pub collection_master_edition: AccountInfo<'info>,
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct SetAndVerifyCollection<'info> {
|
||||
pub metadata: AccountInfo<'info>,
|
||||
pub collection_authority: AccountInfo<'info>,
|
||||
pub payer: AccountInfo<'info>,
|
||||
pub update_authority: AccountInfo<'info>,
|
||||
pub collection_mint: AccountInfo<'info>,
|
||||
pub collection_metadata: AccountInfo<'info>,
|
||||
pub collection_master_edition: AccountInfo<'info>,
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct SetAndVerifySizedCollectionItem<'info> {
|
||||
pub metadata: AccountInfo<'info>,
|
||||
pub collection_authority: AccountInfo<'info>,
|
||||
pub payer: AccountInfo<'info>,
|
||||
pub update_authority: AccountInfo<'info>,
|
||||
pub collection_mint: AccountInfo<'info>,
|
||||
pub collection_metadata: AccountInfo<'info>,
|
||||
pub collection_master_edition: AccountInfo<'info>,
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct FreezeDelegatedAccount<'info> {
|
||||
pub metadata: AccountInfo<'info>,
|
||||
|
|
Loading…
Reference in New Issue