Skip to content

Commit

Permalink
Change instruction data struct visibility (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
febo authored and lorisleiva committed Apr 19, 2024
1 parent 69d2698 commit 92a55a7
Show file tree
Hide file tree
Showing 70 changed files with 163 additions and 136 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-chefs-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@metaplex-foundation/kinobi": patch
---

Change instruction data struct visibility on Rust client
4 changes: 2 additions & 2 deletions src/renderers/rust/templates/instructionsPage.njk
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl {{ instruction.name | pascalCase }} {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct {{ instruction.name | pascalCase }}InstructionData {
pub struct {{ instruction.name | pascalCase }}InstructionData {
{% for arg in instructionArgs %}
{% if arg.default %}
{{ arg.name | snakeCase }}: {{ arg.type }},
Expand All @@ -117,7 +117,7 @@ struct {{ instruction.name | pascalCase }}InstructionData {
}

impl {{ instruction.name | pascalCase }}InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self {
{% for arg in instructionArgs %}
{% if arg.default %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ impl AddConfigLines {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct AddConfigLinesInstructionData {
pub struct AddConfigLinesInstructionData {
discriminator: [u8; 8],
}

impl AddConfigLinesInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self {
discriminator: [223, 50, 224, 227, 151, 8, 115, 106],
}
Expand Down
4 changes: 2 additions & 2 deletions test/packages/rust/src/generated/instructions/add_memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ impl AddMemo {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct AddMemoInstructionData {}
pub struct AddMemoInstructionData {}

impl AddMemoInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ impl ApproveCollectionAuthority {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct ApproveCollectionAuthorityInstructionData {
pub struct ApproveCollectionAuthorityInstructionData {
discriminator: u8,
}

impl ApproveCollectionAuthorityInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 23 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ impl ApproveUseAuthority {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct ApproveUseAuthorityInstructionData {
pub struct ApproveUseAuthorityInstructionData {
discriminator: u8,
}

impl ApproveUseAuthorityInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 20 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ impl BubblegumSetCollectionSize {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct BubblegumSetCollectionSizeInstructionData {
pub struct BubblegumSetCollectionSizeInstructionData {
discriminator: u8,
}

impl BubblegumSetCollectionSizeInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 36 }
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/packages/rust/src/generated/instructions/burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ impl Burn {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct BurnInstructionData {
pub struct BurnInstructionData {
discriminator: u8,
}

impl BurnInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 44 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ impl BurnEditionNft {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct BurnEditionNftInstructionData {
pub struct BurnEditionNftInstructionData {
discriminator: u8,
}

impl BurnEditionNftInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 37 }
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/packages/rust/src/generated/instructions/burn_nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ impl BurnNft {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct BurnNftInstructionData {
pub struct BurnNftInstructionData {
discriminator: u8,
}

impl BurnNftInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 29 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ impl CloseEscrowAccount {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CloseEscrowAccountInstructionData {
pub struct CloseEscrowAccountInstructionData {
discriminator: u8,
}

impl CloseEscrowAccountInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 39 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ impl ConvertMasterEditionV1ToV2 {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct ConvertMasterEditionV1ToV2InstructionData {
pub struct ConvertMasterEditionV1ToV2InstructionData {
discriminator: u8,
}

impl ConvertMasterEditionV1ToV2InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 12 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ impl CreateAccount {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateAccountInstructionData {
pub struct CreateAccountInstructionData {
discriminator: u32,
}

impl CreateAccountInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 0 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ impl CreateEscrowAccount {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateEscrowAccountInstructionData {
pub struct CreateEscrowAccountInstructionData {
discriminator: u8,
}

impl CreateEscrowAccountInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 38 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ impl CreateFrequencyRule {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateFrequencyRuleInstructionData {
pub struct CreateFrequencyRuleInstructionData {
discriminator: u8,
}

impl CreateFrequencyRuleInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 2 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ impl CreateMasterEdition {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateMasterEditionInstructionData {
pub struct CreateMasterEditionInstructionData {
discriminator: u8,
}

impl CreateMasterEditionInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 10 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ impl CreateMasterEditionV3 {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateMasterEditionV3InstructionData {
pub struct CreateMasterEditionV3InstructionData {
discriminator: u8,
}

impl CreateMasterEditionV3InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 17 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ impl CreateMetadataAccount {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateMetadataAccountInstructionData {
pub struct CreateMetadataAccountInstructionData {
discriminator: u8,
}

impl CreateMetadataAccountInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 0 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ impl CreateMetadataAccountV2 {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateMetadataAccountV2InstructionData {
pub struct CreateMetadataAccountV2InstructionData {
discriminator: u8,
}

impl CreateMetadataAccountV2InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 16 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ impl CreateMetadataAccountV3 {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateMetadataAccountV3InstructionData {
pub struct CreateMetadataAccountV3InstructionData {
discriminator: u8,
}

impl CreateMetadataAccountV3InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 33 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ impl CreateReservationList {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateReservationListInstructionData {
pub struct CreateReservationListInstructionData {
discriminator: u8,
}

impl CreateReservationListInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 6 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ impl CreateRuleSet {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateRuleSetInstructionData {
pub struct CreateRuleSetInstructionData {
discriminator: u8,
}

impl CreateRuleSetInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 0 }
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/packages/rust/src/generated/instructions/create_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ impl CreateV1 {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateV1InstructionData {
pub struct CreateV1InstructionData {
discriminator: u8,
create_v1_discriminator: u8,
}

impl CreateV1InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self {
discriminator: 41,
create_v1_discriminator: 0,
Expand Down
4 changes: 2 additions & 2 deletions test/packages/rust/src/generated/instructions/create_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ impl CreateV2 {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct CreateV2InstructionData {
pub struct CreateV2InstructionData {
discriminator: u8,
create_v2_discriminator: u8,
}

impl CreateV2InstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self {
discriminator: 41,
create_v2_discriminator: 1,
Expand Down
4 changes: 2 additions & 2 deletions test/packages/rust/src/generated/instructions/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ impl Delegate {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct DelegateInstructionData {
pub struct DelegateInstructionData {
discriminator: u8,
}

impl DelegateInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 48 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ impl DeprecatedCreateMasterEdition {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct DeprecatedCreateMasterEditionInstructionData {
pub struct DeprecatedCreateMasterEditionInstructionData {
discriminator: u8,
}

impl DeprecatedCreateMasterEditionInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 2 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ impl DeprecatedMintNewEditionFromMasterEditionViaPrintingToken {
}

#[derive(BorshDeserialize, BorshSerialize)]
struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData {
pub struct DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData {
discriminator: u8,
}

impl DeprecatedMintNewEditionFromMasterEditionViaPrintingTokenInstructionData {
fn new() -> Self {
pub fn new() -> Self {
Self { discriminator: 3 }
}
}
Expand Down
Loading

0 comments on commit 92a55a7

Please sign in to comment.