Skip to content

Commit

Permalink
Add pda prefix values (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
febo authored Dec 29, 2023
1 parent df3e341 commit 609bf2d
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 114 deletions.
2 changes: 1 addition & 1 deletion clients/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"typedoc": "^0.23.16",
"typedoc-plugin-expand-object-like-types": "^0.1.1",
"typedoc-plugin-missing-exports": "^1.0.0",
"typescript": "^4.6.2",
"typescript": "^4.9.4",
"vercel": "^28.16.8"
},
"ava": {
Expand Down
2 changes: 1 addition & 1 deletion clients/js/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions clients/rust/src/generated/accounts/collection_authority_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ pub struct CollectionAuthorityRecord {
}

impl CollectionAuthorityRecord {
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `CollectionAuthorityRecord::PREFIX.0`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. `CollectionAuthorityRecord::PREFIX.1`
/// 4. collection_authority (`Pubkey`)
pub const PREFIX: (&'static [u8], &'static [u8]) =
("metadata".as_bytes(), "collection_authority".as_bytes());

pub fn create_pda(
mint: Pubkey,
collection_authority: Pubkey,
Expand Down
11 changes: 11 additions & 0 deletions clients/rust/src/generated/accounts/edition_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ pub struct EditionMarker {

impl EditionMarker {
pub const LEN: usize = 32;
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `EditionMarker::PREFIX.0`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. `EditionMarker::PREFIX.1`
/// 4. edition_marker (`&str`)
pub const PREFIX: (&'static [u8], &'static [u8]) =
("metadata".as_bytes(), "edition".as_bytes());

pub fn create_pda(
mint: Pubkey,
Expand Down
15 changes: 15 additions & 0 deletions clients/rust/src/generated/accounts/edition_marker_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ pub struct EditionMarkerV2 {
}

impl EditionMarkerV2 {
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `EditionMarkerV2::PREFIX.0`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. `EditionMarkerV2::PREFIX.1`
/// 4. `EditionMarkerV2::PREFIX.2`
pub const PREFIX: (&'static [u8], &'static [u8], &'static [u8]) = (
"metadata".as_bytes(),
"edition".as_bytes(),
"marker".as_bytes(),
);

pub fn create_pda(
mint: Pubkey,
bump: u8,
Expand Down
11 changes: 11 additions & 0 deletions clients/rust/src/generated/accounts/master_edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ pub struct MasterEdition {
}

impl MasterEdition {
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `MasterEdition::PREFIX.0`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. `MasterEdition::PREFIX.1`
pub const PREFIX: (&'static [u8], &'static [u8]) =
("metadata".as_bytes(), "edition".as_bytes());

pub fn create_pda(
mint: Pubkey,
bump: u8,
Expand Down
9 changes: 9 additions & 0 deletions clients/rust/src/generated/accounts/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ pub struct Metadata {
}

impl Metadata {
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `Metadata::PREFIX`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
pub const PREFIX: &'static [u8] = "metadata".as_bytes();

pub fn create_pda(
mint: Pubkey,
bump: u8,
Expand Down
11 changes: 11 additions & 0 deletions clients/rust/src/generated/accounts/metadata_delegate_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ pub struct MetadataDelegateRecord {

impl MetadataDelegateRecord {
pub const LEN: usize = 98;
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `MetadataDelegateRecord::PREFIX`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. delegate_role (`MetadataDelegateRoleSeed`)
/// 4. update_authority (`Pubkey`)
/// 5. delegate (`Pubkey`)
pub const PREFIX: &'static [u8] = "metadata".as_bytes();

pub fn create_pda(
mint: Pubkey,
Expand Down
40 changes: 20 additions & 20 deletions clients/rust/src/generated/accounts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
//! [https://github.com/metaplex-foundation/kinobi]
//!
pub(crate) mod collection_authority_record;
pub(crate) mod edition;
pub(crate) mod edition_marker;
pub(crate) mod edition_marker_v2;
pub(crate) mod master_edition;
pub(crate) mod metadata;
pub(crate) mod metadata_delegate_record;
pub(crate) mod token_owned_escrow;
pub(crate) mod token_record;
pub(crate) mod use_authority_record;
pub(crate) mod r#collection_authority_record;
pub(crate) mod r#edition;
pub(crate) mod r#edition_marker;
pub(crate) mod r#edition_marker_v2;
pub(crate) mod r#master_edition;
pub(crate) mod r#metadata;
pub(crate) mod r#metadata_delegate_record;
pub(crate) mod r#token_owned_escrow;
pub(crate) mod r#token_record;
pub(crate) mod r#use_authority_record;

pub use self::collection_authority_record::*;
pub use self::edition::*;
pub use self::edition_marker::*;
pub use self::edition_marker_v2::*;
pub use self::master_edition::*;
pub use self::metadata::*;
pub use self::metadata_delegate_record::*;
pub use self::token_owned_escrow::*;
pub use self::token_record::*;
pub use self::use_authority_record::*;
pub use self::r#collection_authority_record::*;
pub use self::r#edition::*;
pub use self::r#edition_marker::*;
pub use self::r#edition_marker_v2::*;
pub use self::r#master_edition::*;
pub use self::r#metadata::*;
pub use self::r#metadata_delegate_record::*;
pub use self::r#token_owned_escrow::*;
pub use self::r#token_record::*;
pub use self::r#use_authority_record::*;
11 changes: 11 additions & 0 deletions clients/rust/src/generated/accounts/token_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ pub struct TokenRecord {

impl TokenRecord {
pub const LEN: usize = 80;
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `TokenRecord::PREFIX.0`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. `TokenRecord::PREFIX.1`
/// 4. token (`Pubkey`)
pub const PREFIX: (&'static [u8], &'static [u8]) =
("metadata".as_bytes(), "token_record".as_bytes());

pub fn create_pda(
mint: Pubkey,
Expand Down
10 changes: 10 additions & 0 deletions clients/rust/src/generated/accounts/use_authority_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ pub struct UseAuthorityRecord {

impl UseAuthorityRecord {
pub const LEN: usize = 10;
/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
///
/// 0. `UseAuthorityRecord::PREFIX.0`
/// 1. `crate::MPL_TOKEN_METADATA_ID`
/// 2. mint (`Pubkey`)
/// 3. `UseAuthorityRecord::PREFIX.1`
/// 4. use_authority (`Pubkey`)
pub const PREFIX: (&'static [u8], &'static [u8]) = ("metadata".as_bytes(), "user".as_bytes());

pub fn create_pda(
mint: Pubkey,
Expand Down
172 changes: 86 additions & 86 deletions clients/rust/src/generated/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,90 +5,90 @@
//! [https://github.com/metaplex-foundation/kinobi]
//!
pub(crate) mod authority_type;
pub(crate) mod authorization_data;
pub(crate) mod burn_args;
pub(crate) mod collection;
pub(crate) mod collection_details;
pub(crate) mod collection_details_toggle;
pub(crate) mod collection_toggle;
pub(crate) mod create_args;
pub(crate) mod creator;
pub(crate) mod data;
pub(crate) mod data_v2;
pub(crate) mod delegate_args;
pub(crate) mod escrow_authority;
pub(crate) mod key;
pub(crate) mod leaf_info;
pub(crate) mod lock_args;
pub(crate) mod metadata_delegate_role;
pub(crate) mod migration_type;
pub(crate) mod mint_args;
pub(crate) mod mint_new_edition_from_master_edition_via_token_args;
pub(crate) mod payload;
pub(crate) mod payload_key;
pub(crate) mod payload_type;
pub(crate) mod print_args;
pub(crate) mod print_supply;
pub(crate) mod programmable_config;
pub(crate) mod reservation;
pub(crate) mod reservation_v1;
pub(crate) mod revoke_args;
pub(crate) mod rule_set_toggle;
pub(crate) mod seeds_vec;
pub(crate) mod set_collection_size_args;
pub(crate) mod token_delegate_role;
pub(crate) mod token_standard;
pub(crate) mod token_state;
pub(crate) mod transfer_args;
pub(crate) mod unlock_args;
pub(crate) mod update_args;
pub(crate) mod use_args;
pub(crate) mod use_method;
pub(crate) mod uses;
pub(crate) mod uses_toggle;
pub(crate) mod verification_args;
pub(crate) mod r#authority_type;
pub(crate) mod r#authorization_data;
pub(crate) mod r#burn_args;
pub(crate) mod r#collection;
pub(crate) mod r#collection_details;
pub(crate) mod r#collection_details_toggle;
pub(crate) mod r#collection_toggle;
pub(crate) mod r#create_args;
pub(crate) mod r#creator;
pub(crate) mod r#data;
pub(crate) mod r#data_v2;
pub(crate) mod r#delegate_args;
pub(crate) mod r#escrow_authority;
pub(crate) mod r#key;
pub(crate) mod r#leaf_info;
pub(crate) mod r#lock_args;
pub(crate) mod r#metadata_delegate_role;
pub(crate) mod r#migration_type;
pub(crate) mod r#mint_args;
pub(crate) mod r#mint_new_edition_from_master_edition_via_token_args;
pub(crate) mod r#payload;
pub(crate) mod r#payload_key;
pub(crate) mod r#payload_type;
pub(crate) mod r#print_args;
pub(crate) mod r#print_supply;
pub(crate) mod r#programmable_config;
pub(crate) mod r#reservation;
pub(crate) mod r#reservation_v1;
pub(crate) mod r#revoke_args;
pub(crate) mod r#rule_set_toggle;
pub(crate) mod r#seeds_vec;
pub(crate) mod r#set_collection_size_args;
pub(crate) mod r#token_delegate_role;
pub(crate) mod r#token_standard;
pub(crate) mod r#token_state;
pub(crate) mod r#transfer_args;
pub(crate) mod r#unlock_args;
pub(crate) mod r#update_args;
pub(crate) mod r#use_args;
pub(crate) mod r#use_method;
pub(crate) mod r#uses;
pub(crate) mod r#uses_toggle;
pub(crate) mod r#verification_args;

pub use self::authority_type::*;
pub use self::authorization_data::*;
pub use self::burn_args::*;
pub use self::collection::*;
pub use self::collection_details::*;
pub use self::collection_details_toggle::*;
pub use self::collection_toggle::*;
pub use self::create_args::*;
pub use self::creator::*;
pub use self::data::*;
pub use self::data_v2::*;
pub use self::delegate_args::*;
pub use self::escrow_authority::*;
pub use self::key::*;
pub use self::leaf_info::*;
pub use self::lock_args::*;
pub use self::metadata_delegate_role::*;
pub use self::migration_type::*;
pub use self::mint_args::*;
pub use self::mint_new_edition_from_master_edition_via_token_args::*;
pub use self::payload::*;
pub use self::payload_key::*;
pub use self::payload_type::*;
pub use self::print_args::*;
pub use self::print_supply::*;
pub use self::programmable_config::*;
pub use self::reservation::*;
pub use self::reservation_v1::*;
pub use self::revoke_args::*;
pub use self::rule_set_toggle::*;
pub use self::seeds_vec::*;
pub use self::set_collection_size_args::*;
pub use self::token_delegate_role::*;
pub use self::token_standard::*;
pub use self::token_state::*;
pub use self::transfer_args::*;
pub use self::unlock_args::*;
pub use self::update_args::*;
pub use self::use_args::*;
pub use self::use_method::*;
pub use self::uses::*;
pub use self::uses_toggle::*;
pub use self::verification_args::*;
pub use self::r#authority_type::*;
pub use self::r#authorization_data::*;
pub use self::r#burn_args::*;
pub use self::r#collection::*;
pub use self::r#collection_details::*;
pub use self::r#collection_details_toggle::*;
pub use self::r#collection_toggle::*;
pub use self::r#create_args::*;
pub use self::r#creator::*;
pub use self::r#data::*;
pub use self::r#data_v2::*;
pub use self::r#delegate_args::*;
pub use self::r#escrow_authority::*;
pub use self::r#key::*;
pub use self::r#leaf_info::*;
pub use self::r#lock_args::*;
pub use self::r#metadata_delegate_role::*;
pub use self::r#migration_type::*;
pub use self::r#mint_args::*;
pub use self::r#mint_new_edition_from_master_edition_via_token_args::*;
pub use self::r#payload::*;
pub use self::r#payload_key::*;
pub use self::r#payload_type::*;
pub use self::r#print_args::*;
pub use self::r#print_supply::*;
pub use self::r#programmable_config::*;
pub use self::r#reservation::*;
pub use self::r#reservation_v1::*;
pub use self::r#revoke_args::*;
pub use self::r#rule_set_toggle::*;
pub use self::r#seeds_vec::*;
pub use self::r#set_collection_size_args::*;
pub use self::r#token_delegate_role::*;
pub use self::r#token_standard::*;
pub use self::r#token_state::*;
pub use self::r#transfer_args::*;
pub use self::r#unlock_args::*;
pub use self::r#update_args::*;
pub use self::r#use_args::*;
pub use self::r#use_method::*;
pub use self::r#uses::*;
pub use self::r#uses_toggle::*;
pub use self::r#verification_args::*;
2 changes: 1 addition & 1 deletion idls/token_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7761,4 +7761,4 @@
"binaryVersion": "0.3.0",
"libVersion": "0.3.0"
}
}
}
Loading

0 comments on commit 609bf2d

Please sign in to comment.