Skip to content

Commit

Permalink
use new codama renderers (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec authored Jan 15, 2025
1 parent 62c6136 commit 5058b10
Show file tree
Hide file tree
Showing 17 changed files with 301 additions and 186 deletions.
6 changes: 3 additions & 3 deletions clients/js/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './solanaFeatureGate';
6 changes: 3 additions & 3 deletions clients/js/src/generated/errors/solanaFeatureGate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './errors';
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './revokePendingActivation';
28 changes: 20 additions & 8 deletions clients/js/src/generated/instructions/revokePendingActivation.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand All @@ -30,6 +30,12 @@ import {
import { SOLANA_FEATURE_GATE_PROGRAM_ADDRESS } from '../programs';
import { getAccountMetaFactory, type ResolvedAccount } from '../shared';

export const REVOKE_PENDING_ACTIVATION_DISCRIMINATOR = 0;

export function getRevokePendingActivationDiscriminatorBytes() {
return getU8Encoder().encode(REVOKE_PENDING_ACTIVATION_DISCRIMINATOR);
}

export type RevokePendingActivationInstruction<
TProgram extends string = typeof SOLANA_FEATURE_GATE_PROGRAM_ADDRESS,
TAccountFeature extends string | IAccountMeta<string> = string,
Expand Down Expand Up @@ -63,7 +69,10 @@ export type RevokePendingActivationInstructionDataArgs = {};
export function getRevokePendingActivationInstructionDataEncoder(): Encoder<RevokePendingActivationInstructionDataArgs> {
return transformEncoder(
getStructEncoder([['discriminator', getU8Encoder()]]),
(value) => ({ ...value, discriminator: 0 })
(value) => ({
...value,
discriminator: REVOKE_PENDING_ACTIVATION_DISCRIMINATOR,
})
);
}

Expand Down Expand Up @@ -98,20 +107,23 @@ export function getRevokePendingActivationInstruction<
TAccountFeature extends string,
TAccountIncinerator extends string,
TAccountSystemProgram extends string,
TProgramAddress extends Address = typeof SOLANA_FEATURE_GATE_PROGRAM_ADDRESS,
>(
input: RevokePendingActivationInput<
TAccountFeature,
TAccountIncinerator,
TAccountSystemProgram
>
>,
config?: { programAddress?: TProgramAddress }
): RevokePendingActivationInstruction<
typeof SOLANA_FEATURE_GATE_PROGRAM_ADDRESS,
TProgramAddress,
TAccountFeature,
TAccountIncinerator,
TAccountSystemProgram
> {
// Program address.
const programAddress = SOLANA_FEATURE_GATE_PROGRAM_ADDRESS;
const programAddress =
config?.programAddress ?? SOLANA_FEATURE_GATE_PROGRAM_ADDRESS;

// Original accounts.
const originalAccounts = {
Expand Down Expand Up @@ -140,7 +152,7 @@ export function getRevokePendingActivationInstruction<
programAddress,
data: getRevokePendingActivationInstructionDataEncoder().encode({}),
} as RevokePendingActivationInstruction<
typeof SOLANA_FEATURE_GATE_PROGRAM_ADDRESS,
TProgramAddress,
TAccountFeature,
TAccountIncinerator,
TAccountSystemProgram
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/programs/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

export * from './solanaFeatureGate';
6 changes: 3 additions & 3 deletions clients/js/src/generated/programs/solanaFeatureGate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand Down
6 changes: 3 additions & 3 deletions clients/js/src/generated/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* This code was AUTOGENERATED using the codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
* to add features, then rerun codama to update it.
*
* @see https://github.com/kinobi-so/kinobi
* @see https://github.com/codama-idl/codama
*/

import {
Expand Down
6 changes: 3 additions & 3 deletions clients/rust/src/generated/errors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
pub(crate) mod solana_feature_gate;

Expand Down
12 changes: 9 additions & 3 deletions clients/rust/src/generated/errors/solana_feature_gate.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
use {num_derive::FromPrimitive, thiserror::Error};

Expand All @@ -18,3 +18,9 @@ impl solana_program::program_error::PrintProgramError for SolanaFeatureGateError
solana_program::msg!(&self.to_string());
}
}

impl<T> solana_program::decode_error::DecodeError<T> for SolanaFeatureGateError {
fn type_of() -> &'static str {
"SolanaFeatureGateError"
}
}
6 changes: 3 additions & 3 deletions clients/rust/src/generated/instructions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
pub(crate) mod r#revoke_pending_activation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
use borsh::{BorshDeserialize, BorshSerialize};

Expand Down Expand Up @@ -51,7 +51,8 @@ impl RevokePendingActivation {
}
}

#[derive(BorshDeserialize, BorshSerialize)]
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct RevokePendingActivationInstructionData {
discriminator: u8,
}
Expand Down Expand Up @@ -107,7 +108,7 @@ impl RevokePendingActivationBuilder {
self.system_program = Some(system_program);
self
}
/// Add an aditional account to the instruction.
/// Add an additional account to the instruction.
#[inline(always)]
pub fn add_remaining_account(
&mut self,
Expand Down Expand Up @@ -235,7 +236,7 @@ impl<'a, 'b> RevokePendingActivationCpi<'a, 'b> {
accounts,
data,
};
let mut account_infos = Vec::with_capacity(3 + 1 + remaining_accounts.len());
let mut account_infos = Vec::with_capacity(4 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.feature.clone());
account_infos.push(self.incinerator.clone());
Expand Down
6 changes: 3 additions & 3 deletions clients/rust/src/generated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
pub mod errors;
pub mod instructions;
Expand Down
6 changes: 3 additions & 3 deletions clients/rust/src/generated/programs.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! This code was AUTOGENERATED using the kinobi library.
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun kinobi to update it.
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/kinobi-so/kinobi>
//! <https://github.com/codama-idl/codama>
use solana_program::{pubkey, pubkey::Pubkey};

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
},
"devDependencies": {
"@iarna/toml": "^2.2.5",
"@kinobi-so/nodes-from-anchor": "^0.20.9",
"@kinobi-so/renderers-js": "^0.21.2",
"@kinobi-so/renderers-rust": "^0.21.0",
"@codama/nodes-from-anchor": "^1.1.0",
"@codama/renderers-js": "^1.1.1",
"@codama/renderers-rust": "^1.0.6",
"@metaplex-foundation/shank-js": "^0.1.7",
"kinobi": "^0.21.0",
"codama": "^1.2.0",
"typescript": "^5.5.2",
"zx": "^7.2.3"
},
Expand Down
Loading

0 comments on commit 5058b10

Please sign in to comment.