Skip to content

Commit 39380a7

Browse files
authored
add update_primary_sale_happened_via_token ix wrapper for metadata (otter-sec#2173)
* add update_primary_sale_happened_via_token ix wrapper * update changelog
1 parent 1689e73 commit 39380a7

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The minor version will be incremented upon a breaking change and the patch versi
1515
* client: Add `transaction` functions to RequestBuilder ([#1958](https://github.com/coral-xyz/anchor/pull/1958)).
1616
* spl: Add `create_metadata_accounts_v3` and `set_collection_size` wrappers ([#2119](https://github.com/coral-xyz/anchor/pull/2119))
1717
* spl: Add `MetadataAccount` account deserialization. ([#2014](https://github.com/coral-xyz/anchor/pull/2014)).
18+
* spl: Add `update_primary_sale_happened_via_token` wrapper ([#2173](https://github.com/coral-xyz/anchor/pull/2173)).
1819
* lang: Add parsing for consts from impl blocks for IDL PDA seeds generation ([#2128](https://github.com/coral-xyz/anchor/pull/2014))
1920
* lang: Account closing reassigns to system program and reallocates ([#2169](https://github.com/coral-xyz/anchor/pull/2169)).
2021
* ts: Add coders for SPL programs ([#2143](https://github.com/coral-xyz/anchor/pull/2143)).

spl/src/metadata.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,24 @@ pub fn thaw_delegated_account<'info>(
233233
Ok(())
234234
}
235235

236+
pub fn update_primary_sale_happened_via_token<'info>(
237+
ctx: CpiContext<'_, '_, '_, 'info, UpdatePrimarySaleHappenedViaToken<'info>>,
238+
) -> Result<()> {
239+
let ix = mpl_token_metadata::instruction::update_primary_sale_happened_via_token(
240+
ID,
241+
*ctx.accounts.metadata.key,
242+
*ctx.accounts.owner.key,
243+
*ctx.accounts.token.key,
244+
);
245+
246+
solana_program::program::invoke_signed(
247+
&ix,
248+
&ToAccountInfos::to_account_infos(&ctx),
249+
ctx.signer_seeds,
250+
)?;
251+
Ok(())
252+
}
253+
236254
#[derive(Accounts)]
237255
pub struct CreateMetadataAccountsV2<'info> {
238256
pub metadata: AccountInfo<'info>,
@@ -328,6 +346,13 @@ pub struct ThawDelegatedAccount<'info> {
328346
pub token_program: AccountInfo<'info>,
329347
}
330348

349+
#[derive(Accounts)]
350+
pub struct UpdatePrimarySaleHappenedViaToken<'info> {
351+
pub metadata: AccountInfo<'info>,
352+
pub owner: AccountInfo<'info>,
353+
pub token: AccountInfo<'info>,
354+
}
355+
331356
#[derive(Clone, Debug, PartialEq)]
332357
pub struct MetadataAccount(mpl_token_metadata::state::Metadata);
333358

0 commit comments

Comments
 (0)