Skip to content

Commit

Permalink
token-2022: Use serde with rename_all = "camelCase" (#5624)
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque authored Oct 20, 2023
1 parent 245f9a2 commit a630df8
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions token/program-2022/src/extension/cpi_guard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod processor;
/// CPI Guard extension for Accounts
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct CpiGuard {
/// Lock privileged token operations from happening via CPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod processor;
/// Default Account::state extension data for mints.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct DefaultAccountState {
/// Default Account::state in which new Accounts should be initialized
Expand Down
1 change: 1 addition & 0 deletions token/program-2022/src/extension/immutable_owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use serde::{Deserialize, Serialize};

/// Indicates that the Account owner authority cannot be changed
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct ImmutableOwner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub type UnixTimestamp = PodI64;
/// rate.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct InterestBearingConfig {
/// Authority that can set the interest rate and authority
Expand Down
1 change: 1 addition & 0 deletions token/program-2022/src/extension/memo_transfer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod processor;
/// Memo Transfer extension for Accounts
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct MemoTransfer {
/// Require transfers into this account to be accompanied by a memo
Expand Down
1 change: 1 addition & 0 deletions token/program-2022/src/extension/metadata_pointer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod processor;
/// Metadata pointer extension data for mints.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct MetadataPointer {
/// Authority that can set the metadata address
Expand Down
1 change: 1 addition & 0 deletions token/program-2022/src/extension/mint_close_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
/// Close authority extension data for mints.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct MintCloseAuthority {
/// Optional authority to close the mint
Expand Down
2 changes: 2 additions & 0 deletions token/program-2022/src/extension/non_transferable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ use serde::{Deserialize, Serialize};

/// Indicates that the tokens from this mint can't be transfered
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct NonTransferable;

/// Indicates that the tokens from this account belong to a non-transferable mint
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct NonTransferableAccount;
Expand Down
1 change: 1 addition & 0 deletions token/program-2022/src/extension/permanent_delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use serde::{Deserialize, Serialize};
/// Permanent delegate extension data for mints.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct PermanentDelegate {
/// Optional permanent delegate for transferring or burning tokens
Expand Down
5 changes: 5 additions & 0 deletions token/program-2022/src/extension/transfer_fee/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ONE_IN_BASIS_POINTS: u128 = MAX_FEE_BASIS_POINTS as u128;
/// Transfer fee information
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct TransferFee {
/// First epoch where the transfer fee takes effect
Expand Down Expand Up @@ -114,6 +115,8 @@ impl TransferFee {

/// Transfer fee extension data for mints.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct TransferFeeConfig {
/// Optional authority to set the fee
Expand Down Expand Up @@ -152,6 +155,8 @@ impl Extension for TransferFeeConfig {

/// Transfer fee extension data for accounts.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct TransferFeeAmount {
/// Amount withheld during transfers, to be harvested to the mint
Expand Down
2 changes: 2 additions & 0 deletions token/program-2022/src/extension/transfer_hook/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod processor;
/// Transfer hook extension data for mints.
#[repr(C)]
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
pub struct TransferHook {
/// Authority that can set the transfer hook program id
Expand All @@ -31,6 +32,7 @@ pub struct TransferHook {

/// Indicates that the tokens from this account belong to a mint with a transfer hook
#[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
#[repr(transparent)]
pub struct TransferHookAccount {
Expand Down

0 comments on commit a630df8

Please sign in to comment.