From 0572cc945e1b6277cf8c5726c478a52a6de9e452 Mon Sep 17 00:00:00 2001 From: Nagaprasadvr Date: Thu, 19 Dec 2024 13:54:48 +0530 Subject: [PATCH] fix build errors --- packages/renderers-rust/e2e/anchor/Cargo.toml | 27 + .../e2e/anchor/idl.json | 0 .../anchor/src/generated/accounts/guard_v1.rs | 77 ++ .../e2e/anchor/src/generated/accounts/mod.rs | 10 + .../e2e/anchor/src/generated/errors/mod.rs | 10 + .../generated/errors/wen_transfer_guard.rs | 43 ++ .../generated/instructions/create_guard.rs | 709 ++++++++++++++++++ .../src/generated/instructions/execute.rs | 572 ++++++++++++++ .../src/generated/instructions/initialize.rs | 484 ++++++++++++ .../anchor/src/generated/instructions/mod.rs | 16 + .../generated/instructions/update_guard.rs | 577 ++++++++++++++ .../e2e/anchor/src/generated/mod.rs | 14 + .../e2e/anchor/src/generated/programs.rs | 11 + .../anchor/src/generated/types/cpi_rule.rs | 27 + .../metadata_additional_field_restriction.rs | 19 + .../types/metadata_additional_field_rule.rs | 19 + .../e2e/anchor/src/generated/types/mod.rs | 16 + .../generated/types/transfer_amount_rule.rs | 20 + packages/renderers-rust/e2e/anchor/src/lib.rs | 4 + packages/renderers-rust/e2e/dummy/Cargo.lock | 108 ++- packages/renderers-rust/e2e/dummy/Cargo.toml | 3 +- .../generated/instructions/instruction1.rs | 5 +- .../generated/instructions/instruction2.rs | 5 +- .../generated/instructions/instruction3.rs | 5 +- .../generated/instructions/instruction4.rs | 9 +- .../generated/instructions/instruction5.rs | 9 +- .../generated/instructions/instruction6.rs | 5 +- .../generated/instructions/instruction7.rs | 5 +- .../renderers-rust/e2e/generate-anchor.cjs | 37 + packages/renderers-rust/e2e/memo/Cargo.lock | 112 ++- packages/renderers-rust/e2e/memo/Cargo.toml | 3 +- .../src/generated/instructions/add_memo.rs | 9 +- packages/renderers-rust/e2e/system/Cargo.lock | 112 ++- packages/renderers-rust/e2e/system/Cargo.toml | 3 +- .../instructions/advance_nonce_account.rs | 9 +- .../src/generated/instructions/allocate.rs | 9 +- .../instructions/allocate_with_seed.rs | 9 +- .../src/generated/instructions/assign.rs | 9 +- .../instructions/assign_with_seed.rs | 9 +- .../instructions/authorize_nonce_account.rs | 13 +- .../generated/instructions/create_account.rs | 9 +- .../instructions/create_account_with_seed.rs | 13 +- .../instructions/initialize_nonce_account.rs | 13 +- .../generated/instructions/transfer_sol.rs | 9 +- .../instructions/transfer_sol_with_seed.rs | 13 +- .../instructions/upgrade_nonce_account.rs | 9 +- .../instructions/withdraw_nonce_account.rs | 13 +- packages/renderers-rust/package.json | 1 + .../public/templates/instructionsCpiPage.njk | 4 +- .../public/templates/instructionsPage.njk | 5 +- .../e2e/{system => anchor_parser}/Cargo.lock | 666 +++++++++++++++- .../e2e/{anchor => anchor_parser}/Cargo.toml | 1 + .../e2e/anchor_parser/idl.json | 640 ++++++++++++++++ .../src/generated/accounts_parser.rs | 7 +- .../src/generated/instructions_parser.rs | 76 +- .../src/generated/mod.rs | 0 .../e2e/{anchor => anchor_parser}/src/lib.rs | 0 .../e2e/{dummy => dummy_parser}/Cargo.lock | 655 +++++++++++++++- .../e2e/{dummy => dummy_parser}/Cargo.toml | 1 + .../e2e/{dummy => dummy_parser}/idl.json | 0 .../src/generated/instructions_parser.rs | 17 +- .../src/generated/mod.rs | 0 .../e2e/{dummy => dummy_parser}/src/lib.rs | 0 .../e2e/generate-anchor.cjs | 14 +- .../renderers-vixen-parser/e2e/generate.cjs | 16 +- .../e2e/{memo => memo_parser}/Cargo.lock | 655 +++++++++++++++- .../e2e/{memo => memo_parser}/Cargo.toml | 1 + .../e2e/{memo => memo_parser}/idl.json | 0 .../src/generated/instructions_parser.rs | 4 +- .../src/generated/mod.rs | 0 .../e2e/{memo => memo_parser}/src/lib.rs | 0 .../e2e/{anchor => system_parser}/Cargo.lock | 653 +++++++++++++++- .../e2e/{system => system_parser}/Cargo.toml | 2 + .../e2e/{system => system_parser}/idl.json | 0 .../src/generated/accounts_parser.rs | 4 +- .../src/generated/instructions_parser.rs | 123 ++- .../src/generated/mod.rs | 0 .../e2e/{system => system_parser}/src/lib.rs | 0 .../public/templates/accountsParserPage.njk | 23 +- .../templates/instructionsParserPage.njk | 10 +- .../src/getRenderMapVisitor.ts | 17 +- pnpm-lock.yaml | 3 + 82 files changed, 6295 insertions(+), 525 deletions(-) create mode 100644 packages/renderers-rust/e2e/anchor/Cargo.toml rename packages/{renderers-vixen-parser => renderers-rust}/e2e/anchor/idl.json (100%) create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/accounts/guard_v1.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/accounts/mod.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/errors/mod.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/errors/wen_transfer_guard.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/instructions/create_guard.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/instructions/execute.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/instructions/initialize.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/instructions/mod.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/instructions/update_guard.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/mod.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/programs.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/types/cpi_rule.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_restriction.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_rule.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/types/mod.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/generated/types/transfer_amount_rule.rs create mode 100644 packages/renderers-rust/e2e/anchor/src/lib.rs create mode 100644 packages/renderers-rust/e2e/generate-anchor.cjs rename packages/renderers-vixen-parser/e2e/{system => anchor_parser}/Cargo.lock (80%) rename packages/renderers-vixen-parser/e2e/{anchor => anchor_parser}/Cargo.toml (75%) create mode 100644 packages/renderers-vixen-parser/e2e/anchor_parser/idl.json rename packages/renderers-vixen-parser/e2e/{anchor => anchor_parser}/src/generated/accounts_parser.rs (87%) rename packages/renderers-vixen-parser/e2e/{anchor => anchor_parser}/src/generated/instructions_parser.rs (68%) rename packages/renderers-vixen-parser/e2e/{anchor => anchor_parser}/src/generated/mod.rs (100%) rename packages/renderers-vixen-parser/e2e/{anchor => anchor_parser}/src/lib.rs (100%) rename packages/renderers-vixen-parser/e2e/{dummy => dummy_parser}/Cargo.lock (80%) rename packages/renderers-vixen-parser/e2e/{dummy => dummy_parser}/Cargo.toml (75%) rename packages/renderers-vixen-parser/e2e/{dummy => dummy_parser}/idl.json (100%) rename packages/renderers-vixen-parser/e2e/{dummy => dummy_parser}/src/generated/instructions_parser.rs (80%) rename packages/renderers-vixen-parser/e2e/{dummy => dummy_parser}/src/generated/mod.rs (100%) rename packages/renderers-vixen-parser/e2e/{dummy => dummy_parser}/src/lib.rs (100%) rename packages/renderers-vixen-parser/e2e/{memo => memo_parser}/Cargo.lock (80%) rename packages/renderers-vixen-parser/e2e/{memo => memo_parser}/Cargo.toml (76%) rename packages/renderers-vixen-parser/e2e/{memo => memo_parser}/idl.json (100%) rename packages/renderers-vixen-parser/e2e/{memo => memo_parser}/src/generated/instructions_parser.rs (96%) rename packages/renderers-vixen-parser/e2e/{memo => memo_parser}/src/generated/mod.rs (100%) rename packages/renderers-vixen-parser/e2e/{memo => memo_parser}/src/lib.rs (100%) rename packages/renderers-vixen-parser/e2e/{anchor => system_parser}/Cargo.lock (81%) rename packages/renderers-vixen-parser/e2e/{system => system_parser}/Cargo.toml (70%) rename packages/renderers-vixen-parser/e2e/{system => system_parser}/idl.json (100%) rename packages/renderers-vixen-parser/e2e/{system => system_parser}/src/generated/accounts_parser.rs (94%) rename packages/renderers-vixen-parser/e2e/{system => system_parser}/src/generated/instructions_parser.rs (77%) rename packages/renderers-vixen-parser/e2e/{system => system_parser}/src/generated/mod.rs (100%) rename packages/renderers-vixen-parser/e2e/{system => system_parser}/src/lib.rs (100%) diff --git a/packages/renderers-rust/e2e/anchor/Cargo.toml b/packages/renderers-rust/e2e/anchor/Cargo.toml new file mode 100644 index 00000000..6f4ea280 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "codama-renderers-rust-e2e-anchor" +version = "0.0.0" +edition = "2021" + +[features] +anchor = ["dep:anchor-lang"] +anchor-idl-build = ["anchor", "anchor-lang?/idl-build"] +serde = ["dep:serde", "dep:serde_with"] +test-sbf = [] + +[dependencies] +anchor-lang = { version = "0.30.0", optional = true } +borsh = "^1.5.3" +borsh-derive = "^1.5.3" +kaigan = "0.2.5" +num-derive = "^0.3" +num-traits = "^0.2" +serde = { version = "^1.0", features = ["derive"], optional = true } +serde_with = { version = "^3.0", optional = true } +solana-program = "~1.18" +thiserror = "^1.0" + +[dev-dependencies] +assert_matches = "1.5.0" +solana-program-test = "~1.18" +solana-sdk = "~1.18" diff --git a/packages/renderers-vixen-parser/e2e/anchor/idl.json b/packages/renderers-rust/e2e/anchor/idl.json similarity index 100% rename from packages/renderers-vixen-parser/e2e/anchor/idl.json rename to packages/renderers-rust/e2e/anchor/idl.json diff --git a/packages/renderers-rust/e2e/anchor/src/generated/accounts/guard_v1.rs b/packages/renderers-rust/e2e/anchor/src/generated/accounts/guard_v1.rs new file mode 100644 index 00000000..4137b4e0 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/accounts/guard_v1.rs @@ -0,0 +1,77 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::CpiRule; +use crate::generated::types::MetadataAdditionalFieldRule; +use crate::generated::types::TransferAmountRule; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct GuardV1 { + pub discriminator: [u8; 8], + /// Mint token representing the guard, do not confuse with the mint of the token being transferred. + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::") + )] + pub mint: Pubkey, + /// Bump seed for the guard account. + pub bump: u8, + /// CPI ruleset for the guard. + pub cpi_rule: Option, + /// Transfer amount ruleset for the guard. + pub transfer_amount_rule: Option, + /// Additional fields ruleset for the guard. + pub additional_fields_rule: Vec, +} + +impl GuardV1 { + #[inline(always)] + pub fn from_bytes(data: &[u8]) -> Result { + let mut data = data; + Self::deserialize(&mut data) + } +} + +impl<'a> TryFrom<&solana_program::account_info::AccountInfo<'a>> for GuardV1 { + type Error = std::io::Error; + + fn try_from( + account_info: &solana_program::account_info::AccountInfo<'a>, + ) -> Result { + let mut data: &[u8] = &(*account_info.data).borrow(); + Self::deserialize(&mut data) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountDeserialize for GuardV1 { + fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result { + Ok(Self::deserialize(buf)?) + } +} + +#[cfg(feature = "anchor")] +impl anchor_lang::AccountSerialize for GuardV1 {} + +#[cfg(feature = "anchor")] +impl anchor_lang::Owner for GuardV1 { + fn owner() -> Pubkey { + crate::WEN_TRANSFER_GUARD_ID + } +} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::IdlBuild for GuardV1 {} + +#[cfg(feature = "anchor-idl-build")] +impl anchor_lang::Discriminator for GuardV1 { + const DISCRIMINATOR: [u8; 8] = [0; 8]; +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/accounts/mod.rs b/packages/renderers-rust/e2e/anchor/src/generated/accounts/mod.rs new file mode 100644 index 00000000..21f7163b --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/accounts/mod.rs @@ -0,0 +1,10 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod r#guard_v1; + +pub use self::r#guard_v1::*; diff --git a/packages/renderers-rust/e2e/anchor/src/generated/errors/mod.rs b/packages/renderers-rust/e2e/anchor/src/generated/errors/mod.rs new file mode 100644 index 00000000..541cc126 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/errors/mod.rs @@ -0,0 +1,10 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod wen_transfer_guard; + +pub use self::wen_transfer_guard::WenTransferGuardError; diff --git a/packages/renderers-rust/e2e/anchor/src/generated/errors/wen_transfer_guard.rs b/packages/renderers-rust/e2e/anchor/src/generated/errors/wen_transfer_guard.rs new file mode 100644 index 00000000..b31923e4 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/errors/wen_transfer_guard.rs @@ -0,0 +1,43 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use num_derive::FromPrimitive; +use thiserror::Error; + +#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] +pub enum WenTransferGuardError { + /// 6000 - Cpi Rule Enforcement Failed + #[error("Cpi Rule Enforcement Failed")] + CpiRuleEnforcementFailed = 0x1770, + /// 6001 - Transfer Amount Rule Enforce Failed + #[error("Transfer Amount Rule Enforce Failed")] + TransferAmountRuleEnforceFailed = 0x1771, + /// 6002 - Metadata Field Does Not Exist + #[error("Metadata Field Does Not Exist")] + MetadataFieldDoesNotExist = 0x1772, + /// 6003 - Metadata Field Does Not Pass + #[error("Metadata Field Does Not Pass")] + MetadataFieldDoesNotPass = 0x1773, + /// 6004 - Guard token amount should be at least 1 + #[error("Guard token amount should be at least 1")] + GuardTokenAmountShouldBeAtLeastOne = 0x1774, + /// 6005 - Not owned by token 2022 program + #[error("Not owned by token 2022 program")] + NotOwnedByToken2022Program = 0x1775, + /// 6006 - Must be initialized by Transfer Hook Authority + #[error("Must be initialized by Transfer Hook Authority")] + MustBeInitializedByTransferHookAuthority = 0x1776, + /// 6007 - Mint's assigned Transfer Hook Program is not this one + #[error("Mint's assigned Transfer Hook Program is not this one")] + MintAssignedTransferHookProgramIsNotThisOne = 0x1777, +} + +impl solana_program::program_error::PrintProgramError for WenTransferGuardError { + fn print(&self) { + solana_program::msg!(&self.to_string()); + } +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/instructions/create_guard.rs b/packages/renderers-rust/e2e/anchor/src/generated/instructions/create_guard.rs new file mode 100644 index 00000000..8b61a49f --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/instructions/create_guard.rs @@ -0,0 +1,709 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::CpiRule; +use crate::generated::types::MetadataAdditionalFieldRule; +use crate::generated::types::TransferAmountRule; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +#[derive(Debug)] +pub struct CreateGuard { + pub guard: solana_program::pubkey::Pubkey, + + pub mint: solana_program::pubkey::Pubkey, + + pub mint_token_account: solana_program::pubkey::Pubkey, + + pub guard_authority: solana_program::pubkey::Pubkey, + + pub payer: solana_program::pubkey::Pubkey, + + pub associated_token_program: solana_program::pubkey::Pubkey, + + pub token_program: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, +} + +impl CreateGuard { + pub fn instruction( + &self, + args: CreateGuardInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: CreateGuardInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(8 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.guard, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.mint_token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.guard_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.associated_token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = borsh::to_vec(&CreateGuardInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +pub struct CreateGuardInstructionData { + discriminator: [u8; 8], +} + +impl CreateGuardInstructionData { + pub fn new() -> Self { + Self { + discriminator: [251, 254, 17, 198, 219, 218, 154, 99], + } + } +} + +impl Default for CreateGuardInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct CreateGuardInstructionArgs { + pub name: String, + pub symbol: String, + pub uri: String, + pub cpi_rule: Option, + pub transfer_amount_rule: Option, + pub additional_fields_rule: Vec, +} + +/// Instruction builder for `CreateGuard`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` guard +/// 1. `[writable, signer]` mint +/// 2. `[writable]` mint_token_account +/// 3. `[signer]` guard_authority +/// 4. `[writable, signer]` payer +/// 5. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`) +/// 6. `[optional]` token_program (default to `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`) +/// 7. `[optional]` system_program (default to `11111111111111111111111111111111`) +#[derive(Clone, Debug, Default)] +pub struct CreateGuardBuilder { + guard: Option, + mint: Option, + mint_token_account: Option, + guard_authority: Option, + payer: Option, + associated_token_program: Option, + token_program: Option, + system_program: Option, + name: Option, + symbol: Option, + uri: Option, + cpi_rule: Option, + transfer_amount_rule: Option, + additional_fields_rule: Option>, + __remaining_accounts: Vec, +} + +impl CreateGuardBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn guard(&mut self, guard: solana_program::pubkey::Pubkey) -> &mut Self { + self.guard = Some(guard); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn mint_token_account( + &mut self, + mint_token_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.mint_token_account = Some(mint_token_account); + self + } + #[inline(always)] + pub fn guard_authority( + &mut self, + guard_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.guard_authority = Some(guard_authority); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']` + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.associated_token_program = Some(associated_token_program); + self + } + /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn name(&mut self, name: String) -> &mut Self { + self.name = Some(name); + self + } + #[inline(always)] + pub fn symbol(&mut self, symbol: String) -> &mut Self { + self.symbol = Some(symbol); + self + } + #[inline(always)] + pub fn uri(&mut self, uri: String) -> &mut Self { + self.uri = Some(uri); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn cpi_rule(&mut self, cpi_rule: CpiRule) -> &mut Self { + self.cpi_rule = Some(cpi_rule); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn transfer_amount_rule(&mut self, transfer_amount_rule: TransferAmountRule) -> &mut Self { + self.transfer_amount_rule = Some(transfer_amount_rule); + self + } + #[inline(always)] + pub fn additional_fields_rule( + &mut self, + additional_fields_rule: Vec, + ) -> &mut Self { + self.additional_fields_rule = Some(additional_fields_rule); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = CreateGuard { + guard: self.guard.expect("guard is not set"), + mint: self.mint.expect("mint is not set"), + mint_token_account: self + .mint_token_account + .expect("mint_token_account is not set"), + guard_authority: self.guard_authority.expect("guard_authority is not set"), + payer: self.payer.expect("payer is not set"), + associated_token_program: self.associated_token_program.unwrap_or( + solana_program::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), + ), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = CreateGuardInstructionArgs { + name: self.name.clone().expect("name is not set"), + symbol: self.symbol.clone().expect("symbol is not set"), + uri: self.uri.clone().expect("uri is not set"), + cpi_rule: self.cpi_rule.clone(), + transfer_amount_rule: self.transfer_amount_rule.clone(), + additional_fields_rule: self + .additional_fields_rule + .clone() + .expect("additional_fields_rule is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `create_guard` CPI accounts. +pub struct CreateGuardCpiAccounts<'a, 'b> { + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint_token_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `create_guard` CPI instruction. +pub struct CreateGuardCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint_token_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, + + pub associated_token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: CreateGuardInstructionArgs, +} + +impl<'a, 'b> CreateGuardCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: CreateGuardCpiAccounts<'a, 'b>, + args: CreateGuardInstructionArgs, + ) -> Self { + Self { + __program: program, + guard: accounts.guard, + mint: accounts.mint, + mint_token_account: accounts.mint_token_account, + guard_authority: accounts.guard_authority, + payer: accounts.payer, + associated_token_program: accounts.associated_token_program, + token_program: accounts.token_program, + system_program: accounts.system_program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(8 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.guard.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.mint_token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.guard_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.associated_token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = borsh::to_vec(&CreateGuardInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(9 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.guard.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.mint_token_account.clone()); + account_infos.push(self.guard_authority.clone()); + account_infos.push(self.payer.clone()); + account_infos.push(self.associated_token_program.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `CreateGuard` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` guard +/// 1. `[writable, signer]` mint +/// 2. `[writable]` mint_token_account +/// 3. `[signer]` guard_authority +/// 4. `[writable, signer]` payer +/// 5. `[]` associated_token_program +/// 6. `[]` token_program +/// 7. `[]` system_program +#[derive(Clone, Debug)] +pub struct CreateGuardCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> CreateGuardCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(CreateGuardCpiBuilderInstruction { + __program: program, + guard: None, + mint: None, + mint_token_account: None, + guard_authority: None, + payer: None, + associated_token_program: None, + token_program: None, + system_program: None, + name: None, + symbol: None, + uri: None, + cpi_rule: None, + transfer_amount_rule: None, + additional_fields_rule: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn guard(&mut self, guard: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.guard = Some(guard); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn mint_token_account( + &mut self, + mint_token_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.mint_token_account = Some(mint_token_account); + self + } + #[inline(always)] + pub fn guard_authority( + &mut self, + guard_authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.guard_authority = Some(guard_authority); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + #[inline(always)] + pub fn associated_token_program( + &mut self, + associated_token_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.associated_token_program = Some(associated_token_program); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn name(&mut self, name: String) -> &mut Self { + self.instruction.name = Some(name); + self + } + #[inline(always)] + pub fn symbol(&mut self, symbol: String) -> &mut Self { + self.instruction.symbol = Some(symbol); + self + } + #[inline(always)] + pub fn uri(&mut self, uri: String) -> &mut Self { + self.instruction.uri = Some(uri); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn cpi_rule(&mut self, cpi_rule: CpiRule) -> &mut Self { + self.instruction.cpi_rule = Some(cpi_rule); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn transfer_amount_rule(&mut self, transfer_amount_rule: TransferAmountRule) -> &mut Self { + self.instruction.transfer_amount_rule = Some(transfer_amount_rule); + self + } + #[inline(always)] + pub fn additional_fields_rule( + &mut self, + additional_fields_rule: Vec, + ) -> &mut Self { + self.instruction.additional_fields_rule = Some(additional_fields_rule); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = CreateGuardInstructionArgs { + name: self.instruction.name.clone().expect("name is not set"), + symbol: self.instruction.symbol.clone().expect("symbol is not set"), + uri: self.instruction.uri.clone().expect("uri is not set"), + cpi_rule: self.instruction.cpi_rule.clone(), + transfer_amount_rule: self.instruction.transfer_amount_rule.clone(), + additional_fields_rule: self + .instruction + .additional_fields_rule + .clone() + .expect("additional_fields_rule is not set"), + }; + let instruction = CreateGuardCpi { + __program: self.instruction.__program, + + guard: self.instruction.guard.expect("guard is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + mint_token_account: self + .instruction + .mint_token_account + .expect("mint_token_account is not set"), + + guard_authority: self + .instruction + .guard_authority + .expect("guard_authority is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + + associated_token_program: self + .instruction + .associated_token_program + .expect("associated_token_program is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct CreateGuardCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + guard: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mint_token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + guard_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + associated_token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + name: Option, + symbol: Option, + uri: Option, + cpi_rule: Option, + transfer_amount_rule: Option, + additional_fields_rule: Option>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/instructions/execute.rs b/packages/renderers-rust/e2e/anchor/src/generated/instructions/execute.rs new file mode 100644 index 00000000..5c0ca0f4 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/instructions/execute.rs @@ -0,0 +1,572 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +#[derive(Debug)] +pub struct Execute { + pub source_account: solana_program::pubkey::Pubkey, + + pub mint: solana_program::pubkey::Pubkey, + + pub destination_account: solana_program::pubkey::Pubkey, + + pub owner_delegate: solana_program::pubkey::Pubkey, + + pub extra_metas_account: solana_program::pubkey::Pubkey, + + pub guard: solana_program::pubkey::Pubkey, + + pub instruction_sysvar_account: solana_program::pubkey::Pubkey, +} + +impl Execute { + pub fn instruction( + &self, + args: ExecuteInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: ExecuteInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(7 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.source_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.destination_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.owner_delegate, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.extra_metas_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.guard, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.instruction_sysvar_account, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = borsh::to_vec(&ExecuteInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +pub struct ExecuteInstructionData { + discriminator: [u8; 8], +} + +impl ExecuteInstructionData { + pub fn new() -> Self { + Self { + discriminator: [105, 37, 101, 197, 75, 251, 102, 26], + } + } +} + +impl Default for ExecuteInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ExecuteInstructionArgs { + pub amount: u64, +} + +/// Instruction builder for `Execute`. +/// +/// ### Accounts: +/// +/// 0. `[]` source_account +/// 1. `[]` mint +/// 2. `[]` destination_account +/// 3. `[]` owner_delegate +/// 4. `[]` extra_metas_account +/// 5. `[]` guard +/// 6. `[optional]` instruction_sysvar_account (default to `Sysvar1nstructions1111111111111111111111111`) +#[derive(Clone, Debug, Default)] +pub struct ExecuteBuilder { + source_account: Option, + mint: Option, + destination_account: Option, + owner_delegate: Option, + extra_metas_account: Option, + guard: Option, + instruction_sysvar_account: Option, + amount: Option, + __remaining_accounts: Vec, +} + +impl ExecuteBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn source_account(&mut self, source_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.source_account = Some(source_account); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn destination_account( + &mut self, + destination_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.destination_account = Some(destination_account); + self + } + #[inline(always)] + pub fn owner_delegate(&mut self, owner_delegate: solana_program::pubkey::Pubkey) -> &mut Self { + self.owner_delegate = Some(owner_delegate); + self + } + #[inline(always)] + pub fn extra_metas_account( + &mut self, + extra_metas_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.extra_metas_account = Some(extra_metas_account); + self + } + #[inline(always)] + pub fn guard(&mut self, guard: solana_program::pubkey::Pubkey) -> &mut Self { + self.guard = Some(guard); + self + } + /// `[optional account, default to 'Sysvar1nstructions1111111111111111111111111']` + #[inline(always)] + pub fn instruction_sysvar_account( + &mut self, + instruction_sysvar_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.instruction_sysvar_account = Some(instruction_sysvar_account); + self + } + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.amount = Some(amount); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = Execute { + source_account: self.source_account.expect("source_account is not set"), + mint: self.mint.expect("mint is not set"), + destination_account: self + .destination_account + .expect("destination_account is not set"), + owner_delegate: self.owner_delegate.expect("owner_delegate is not set"), + extra_metas_account: self + .extra_metas_account + .expect("extra_metas_account is not set"), + guard: self.guard.expect("guard is not set"), + instruction_sysvar_account: self.instruction_sysvar_account.unwrap_or( + solana_program::pubkey!("Sysvar1nstructions1111111111111111111111111"), + ), + }; + let args = ExecuteInstructionArgs { + amount: self.amount.clone().expect("amount is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `execute` CPI accounts. +pub struct ExecuteCpiAccounts<'a, 'b> { + pub source_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub destination_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub owner_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub extra_metas_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub instruction_sysvar_account: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `execute` CPI instruction. +pub struct ExecuteCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub source_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub destination_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub owner_delegate: &'b solana_program::account_info::AccountInfo<'a>, + + pub extra_metas_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub instruction_sysvar_account: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: ExecuteInstructionArgs, +} + +impl<'a, 'b> ExecuteCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: ExecuteCpiAccounts<'a, 'b>, + args: ExecuteInstructionArgs, + ) -> Self { + Self { + __program: program, + source_account: accounts.source_account, + mint: accounts.mint, + destination_account: accounts.destination_account, + owner_delegate: accounts.owner_delegate, + extra_metas_account: accounts.extra_metas_account, + guard: accounts.guard, + instruction_sysvar_account: accounts.instruction_sysvar_account, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(7 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.source_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.destination_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.owner_delegate.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.extra_metas_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.guard.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.instruction_sysvar_account.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = borsh::to_vec(&ExecuteInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(8 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.source_account.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.destination_account.clone()); + account_infos.push(self.owner_delegate.clone()); + account_infos.push(self.extra_metas_account.clone()); + account_infos.push(self.guard.clone()); + account_infos.push(self.instruction_sysvar_account.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `Execute` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[]` source_account +/// 1. `[]` mint +/// 2. `[]` destination_account +/// 3. `[]` owner_delegate +/// 4. `[]` extra_metas_account +/// 5. `[]` guard +/// 6. `[]` instruction_sysvar_account +#[derive(Clone, Debug)] +pub struct ExecuteCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> ExecuteCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(ExecuteCpiBuilderInstruction { + __program: program, + source_account: None, + mint: None, + destination_account: None, + owner_delegate: None, + extra_metas_account: None, + guard: None, + instruction_sysvar_account: None, + amount: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn source_account( + &mut self, + source_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.source_account = Some(source_account); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn destination_account( + &mut self, + destination_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.destination_account = Some(destination_account); + self + } + #[inline(always)] + pub fn owner_delegate( + &mut self, + owner_delegate: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.owner_delegate = Some(owner_delegate); + self + } + #[inline(always)] + pub fn extra_metas_account( + &mut self, + extra_metas_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.extra_metas_account = Some(extra_metas_account); + self + } + #[inline(always)] + pub fn guard(&mut self, guard: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.guard = Some(guard); + self + } + #[inline(always)] + pub fn instruction_sysvar_account( + &mut self, + instruction_sysvar_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.instruction_sysvar_account = Some(instruction_sysvar_account); + self + } + #[inline(always)] + pub fn amount(&mut self, amount: u64) -> &mut Self { + self.instruction.amount = Some(amount); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = ExecuteInstructionArgs { + amount: self.instruction.amount.clone().expect("amount is not set"), + }; + let instruction = ExecuteCpi { + __program: self.instruction.__program, + + source_account: self + .instruction + .source_account + .expect("source_account is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + destination_account: self + .instruction + .destination_account + .expect("destination_account is not set"), + + owner_delegate: self + .instruction + .owner_delegate + .expect("owner_delegate is not set"), + + extra_metas_account: self + .instruction + .extra_metas_account + .expect("extra_metas_account is not set"), + + guard: self.instruction.guard.expect("guard is not set"), + + instruction_sysvar_account: self + .instruction + .instruction_sysvar_account + .expect("instruction_sysvar_account is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct ExecuteCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + source_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'b solana_program::account_info::AccountInfo<'a>>, + destination_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + owner_delegate: Option<&'b solana_program::account_info::AccountInfo<'a>>, + extra_metas_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + guard: Option<&'b solana_program::account_info::AccountInfo<'a>>, + instruction_sysvar_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + amount: Option, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/instructions/initialize.rs b/packages/renderers-rust/e2e/anchor/src/generated/instructions/initialize.rs new file mode 100644 index 00000000..a24e9d81 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/instructions/initialize.rs @@ -0,0 +1,484 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +#[derive(Debug)] +pub struct Initialize { + pub extra_metas_account: solana_program::pubkey::Pubkey, + + pub guard: solana_program::pubkey::Pubkey, + + pub mint: solana_program::pubkey::Pubkey, + + pub transfer_hook_authority: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, + + pub payer: solana_program::pubkey::Pubkey, +} + +impl Initialize { + pub fn instruction(&self) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(&[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.extra_metas_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.guard, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.transfer_hook_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + self.payer, true, + )); + accounts.extend_from_slice(remaining_accounts); + let data = borsh::to_vec(&InitializeInstructionData::new()).unwrap(); + + solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +pub struct InitializeInstructionData { + discriminator: [u8; 8], +} + +impl InitializeInstructionData { + pub fn new() -> Self { + Self { + discriminator: [43, 34, 13, 49, 167, 88, 235, 235], + } + } +} + +impl Default for InitializeInstructionData { + fn default() -> Self { + Self::new() + } +} + +/// Instruction builder for `Initialize`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` extra_metas_account +/// 1. `[]` guard +/// 2. `[]` mint +/// 3. `[writable, signer]` transfer_hook_authority +/// 4. `[optional]` system_program (default to `11111111111111111111111111111111`) +/// 5. `[writable, signer]` payer +#[derive(Clone, Debug, Default)] +pub struct InitializeBuilder { + extra_metas_account: Option, + guard: Option, + mint: Option, + transfer_hook_authority: Option, + system_program: Option, + payer: Option, + __remaining_accounts: Vec, +} + +impl InitializeBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn extra_metas_account( + &mut self, + extra_metas_account: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.extra_metas_account = Some(extra_metas_account); + self + } + #[inline(always)] + pub fn guard(&mut self, guard: solana_program::pubkey::Pubkey) -> &mut Self { + self.guard = Some(guard); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn transfer_hook_authority( + &mut self, + transfer_hook_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.transfer_hook_authority = Some(transfer_hook_authority); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: solana_program::pubkey::Pubkey) -> &mut Self { + self.payer = Some(payer); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = Initialize { + extra_metas_account: self + .extra_metas_account + .expect("extra_metas_account is not set"), + guard: self.guard.expect("guard is not set"), + mint: self.mint.expect("mint is not set"), + transfer_hook_authority: self + .transfer_hook_authority + .expect("transfer_hook_authority is not set"), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + payer: self.payer.expect("payer is not set"), + }; + + accounts.instruction_with_remaining_accounts(&self.__remaining_accounts) + } +} + +/// `initialize` CPI accounts. +pub struct InitializeCpiAccounts<'a, 'b> { + pub extra_metas_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub transfer_hook_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `initialize` CPI instruction. +pub struct InitializeCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub extra_metas_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub transfer_hook_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub payer: &'b solana_program::account_info::AccountInfo<'a>, +} + +impl<'a, 'b> InitializeCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: InitializeCpiAccounts<'a, 'b>, + ) -> Self { + Self { + __program: program, + extra_metas_account: accounts.extra_metas_account, + guard: accounts.guard, + mint: accounts.mint, + transfer_hook_authority: accounts.transfer_hook_authority, + system_program: accounts.system_program, + payer: accounts.payer, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.extra_metas_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.guard.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.transfer_hook_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.payer.key, + true, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let data = borsh::to_vec(&InitializeInstructionData::new()).unwrap(); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.extra_metas_account.clone()); + account_infos.push(self.guard.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.transfer_hook_authority.clone()); + account_infos.push(self.system_program.clone()); + account_infos.push(self.payer.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `Initialize` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` extra_metas_account +/// 1. `[]` guard +/// 2. `[]` mint +/// 3. `[writable, signer]` transfer_hook_authority +/// 4. `[]` system_program +/// 5. `[writable, signer]` payer +#[derive(Clone, Debug)] +pub struct InitializeCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> InitializeCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(InitializeCpiBuilderInstruction { + __program: program, + extra_metas_account: None, + guard: None, + mint: None, + transfer_hook_authority: None, + system_program: None, + payer: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn extra_metas_account( + &mut self, + extra_metas_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.extra_metas_account = Some(extra_metas_account); + self + } + #[inline(always)] + pub fn guard(&mut self, guard: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.guard = Some(guard); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn transfer_hook_authority( + &mut self, + transfer_hook_authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.transfer_hook_authority = Some(transfer_hook_authority); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + #[inline(always)] + pub fn payer(&mut self, payer: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.payer = Some(payer); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let instruction = InitializeCpi { + __program: self.instruction.__program, + + extra_metas_account: self + .instruction + .extra_metas_account + .expect("extra_metas_account is not set"), + + guard: self.instruction.guard.expect("guard is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + transfer_hook_authority: self + .instruction + .transfer_hook_authority + .expect("transfer_hook_authority is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + + payer: self.instruction.payer.expect("payer is not set"), + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct InitializeCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + extra_metas_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + guard: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'b solana_program::account_info::AccountInfo<'a>>, + transfer_hook_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + payer: Option<&'b solana_program::account_info::AccountInfo<'a>>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/instructions/mod.rs b/packages/renderers-rust/e2e/anchor/src/generated/instructions/mod.rs new file mode 100644 index 00000000..594c78f1 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/instructions/mod.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod r#create_guard; +pub(crate) mod r#execute; +pub(crate) mod r#initialize; +pub(crate) mod r#update_guard; + +pub use self::r#create_guard::*; +pub use self::r#execute::*; +pub use self::r#initialize::*; +pub use self::r#update_guard::*; diff --git a/packages/renderers-rust/e2e/anchor/src/generated/instructions/update_guard.rs b/packages/renderers-rust/e2e/anchor/src/generated/instructions/update_guard.rs new file mode 100644 index 00000000..94534d3b --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/instructions/update_guard.rs @@ -0,0 +1,577 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::CpiRule; +use crate::generated::types::MetadataAdditionalFieldRule; +use crate::generated::types::TransferAmountRule; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Accounts. +#[derive(Debug)] +pub struct UpdateGuard { + pub guard: solana_program::pubkey::Pubkey, + + pub mint: solana_program::pubkey::Pubkey, + + pub token_account: solana_program::pubkey::Pubkey, + + pub guard_authority: solana_program::pubkey::Pubkey, + + pub token_program: solana_program::pubkey::Pubkey, + + pub system_program: solana_program::pubkey::Pubkey, +} + +impl UpdateGuard { + pub fn instruction( + &self, + args: UpdateGuardInstructionArgs, + ) -> solana_program::instruction::Instruction { + self.instruction_with_remaining_accounts(args, &[]) + } + #[allow(clippy::vec_init_then_push)] + pub fn instruction_with_remaining_accounts( + &self, + args: UpdateGuardInstructionArgs, + remaining_accounts: &[solana_program::instruction::AccountMeta], + ) -> solana_program::instruction::Instruction { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + self.guard, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.mint, false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_account, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.guard_authority, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.token_program, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.system_program, + false, + )); + accounts.extend_from_slice(remaining_accounts); + let mut data = borsh::to_vec(&UpdateGuardInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); + data.append(&mut args); + + solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + } + } +} + +#[derive(BorshDeserialize, BorshSerialize)] +pub struct UpdateGuardInstructionData { + discriminator: [u8; 8], +} + +impl UpdateGuardInstructionData { + pub fn new() -> Self { + Self { + discriminator: [51, 38, 175, 180, 25, 249, 39, 24], + } + } +} + +impl Default for UpdateGuardInstructionData { + fn default() -> Self { + Self::new() + } +} + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct UpdateGuardInstructionArgs { + pub cpi_rule: Option, + pub transfer_amount_rule: Option, + pub additional_fields_rule: Vec, +} + +/// Instruction builder for `UpdateGuard`. +/// +/// ### Accounts: +/// +/// 0. `[writable]` guard +/// 1. `[]` mint +/// 2. `[]` token_account +/// 3. `[signer]` guard_authority +/// 4. `[optional]` token_program (default to `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`) +/// 5. `[optional]` system_program (default to `11111111111111111111111111111111`) +#[derive(Clone, Debug, Default)] +pub struct UpdateGuardBuilder { + guard: Option, + mint: Option, + token_account: Option, + guard_authority: Option, + token_program: Option, + system_program: Option, + cpi_rule: Option, + transfer_amount_rule: Option, + additional_fields_rule: Option>, + __remaining_accounts: Vec, +} + +impl UpdateGuardBuilder { + pub fn new() -> Self { + Self::default() + } + #[inline(always)] + pub fn guard(&mut self, guard: solana_program::pubkey::Pubkey) -> &mut Self { + self.guard = Some(guard); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: solana_program::pubkey::Pubkey) -> &mut Self { + self.mint = Some(mint); + self + } + #[inline(always)] + pub fn token_account(&mut self, token_account: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_account = Some(token_account); + self + } + #[inline(always)] + pub fn guard_authority( + &mut self, + guard_authority: solana_program::pubkey::Pubkey, + ) -> &mut Self { + self.guard_authority = Some(guard_authority); + self + } + /// `[optional account, default to 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb']` + #[inline(always)] + pub fn token_program(&mut self, token_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.token_program = Some(token_program); + self + } + /// `[optional account, default to '11111111111111111111111111111111']` + #[inline(always)] + pub fn system_program(&mut self, system_program: solana_program::pubkey::Pubkey) -> &mut Self { + self.system_program = Some(system_program); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn cpi_rule(&mut self, cpi_rule: CpiRule) -> &mut Self { + self.cpi_rule = Some(cpi_rule); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn transfer_amount_rule(&mut self, transfer_amount_rule: TransferAmountRule) -> &mut Self { + self.transfer_amount_rule = Some(transfer_amount_rule); + self + } + #[inline(always)] + pub fn additional_fields_rule( + &mut self, + additional_fields_rule: Vec, + ) -> &mut Self { + self.additional_fields_rule = Some(additional_fields_rule); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: solana_program::instruction::AccountMeta, + ) -> &mut Self { + self.__remaining_accounts.push(account); + self + } + /// Add additional accounts to the instruction. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[solana_program::instruction::AccountMeta], + ) -> &mut Self { + self.__remaining_accounts.extend_from_slice(accounts); + self + } + #[allow(clippy::clone_on_copy)] + pub fn instruction(&self) -> solana_program::instruction::Instruction { + let accounts = UpdateGuard { + guard: self.guard.expect("guard is not set"), + mint: self.mint.expect("mint is not set"), + token_account: self.token_account.expect("token_account is not set"), + guard_authority: self.guard_authority.expect("guard_authority is not set"), + token_program: self.token_program.unwrap_or(solana_program::pubkey!( + "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + )), + system_program: self + .system_program + .unwrap_or(solana_program::pubkey!("11111111111111111111111111111111")), + }; + let args = UpdateGuardInstructionArgs { + cpi_rule: self.cpi_rule.clone(), + transfer_amount_rule: self.transfer_amount_rule.clone(), + additional_fields_rule: self + .additional_fields_rule + .clone() + .expect("additional_fields_rule is not set"), + }; + + accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) + } +} + +/// `update_guard` CPI accounts. +pub struct UpdateGuardCpiAccounts<'a, 'b> { + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub token_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, +} + +/// `update_guard` CPI instruction. +pub struct UpdateGuardCpi<'a, 'b> { + /// The program to invoke. + pub __program: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard: &'b solana_program::account_info::AccountInfo<'a>, + + pub mint: &'b solana_program::account_info::AccountInfo<'a>, + + pub token_account: &'b solana_program::account_info::AccountInfo<'a>, + + pub guard_authority: &'b solana_program::account_info::AccountInfo<'a>, + + pub token_program: &'b solana_program::account_info::AccountInfo<'a>, + + pub system_program: &'b solana_program::account_info::AccountInfo<'a>, + /// The arguments for the instruction. + pub __args: UpdateGuardInstructionArgs, +} + +impl<'a, 'b> UpdateGuardCpi<'a, 'b> { + pub fn new( + program: &'b solana_program::account_info::AccountInfo<'a>, + accounts: UpdateGuardCpiAccounts<'a, 'b>, + args: UpdateGuardInstructionArgs, + ) -> Self { + Self { + __program: program, + guard: accounts.guard, + mint: accounts.mint, + token_account: accounts.token_account, + guard_authority: accounts.guard_authority, + token_program: accounts.token_program, + system_program: accounts.system_program, + __args: args, + } + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], &[]) + } + #[inline(always)] + pub fn invoke_with_remaining_accounts( + &self, + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(&[], remaining_accounts) + } + #[inline(always)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed_with_remaining_accounts(signers_seeds, &[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed_with_remaining_accounts( + &self, + signers_seeds: &[&[&[u8]]], + remaining_accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> solana_program::entrypoint::ProgramResult { + let mut accounts = Vec::with_capacity(6 + remaining_accounts.len()); + accounts.push(solana_program::instruction::AccountMeta::new( + *self.guard.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.mint.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_account.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.guard_authority.key, + true, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.token_program.key, + false, + )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.system_program.key, + false, + )); + remaining_accounts.iter().for_each(|remaining_account| { + accounts.push(solana_program::instruction::AccountMeta { + pubkey: *remaining_account.0.key, + is_signer: remaining_account.1, + is_writable: remaining_account.2, + }) + }); + let mut data = borsh::to_vec(&UpdateGuardInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); + data.append(&mut args); + + let instruction = solana_program::instruction::Instruction { + program_id: crate::WEN_TRANSFER_GUARD_ID, + accounts, + data, + }; + let mut account_infos = Vec::with_capacity(7 + remaining_accounts.len()); + account_infos.push(self.__program.clone()); + account_infos.push(self.guard.clone()); + account_infos.push(self.mint.clone()); + account_infos.push(self.token_account.clone()); + account_infos.push(self.guard_authority.clone()); + account_infos.push(self.token_program.clone()); + account_infos.push(self.system_program.clone()); + remaining_accounts + .iter() + .for_each(|remaining_account| account_infos.push(remaining_account.0.clone())); + + if signers_seeds.is_empty() { + solana_program::program::invoke(&instruction, &account_infos) + } else { + solana_program::program::invoke_signed(&instruction, &account_infos, signers_seeds) + } + } +} + +/// Instruction builder for `UpdateGuard` via CPI. +/// +/// ### Accounts: +/// +/// 0. `[writable]` guard +/// 1. `[]` mint +/// 2. `[]` token_account +/// 3. `[signer]` guard_authority +/// 4. `[]` token_program +/// 5. `[]` system_program +#[derive(Clone, Debug)] +pub struct UpdateGuardCpiBuilder<'a, 'b> { + instruction: Box>, +} + +impl<'a, 'b> UpdateGuardCpiBuilder<'a, 'b> { + pub fn new(program: &'b solana_program::account_info::AccountInfo<'a>) -> Self { + let instruction = Box::new(UpdateGuardCpiBuilderInstruction { + __program: program, + guard: None, + mint: None, + token_account: None, + guard_authority: None, + token_program: None, + system_program: None, + cpi_rule: None, + transfer_amount_rule: None, + additional_fields_rule: None, + __remaining_accounts: Vec::new(), + }); + Self { instruction } + } + #[inline(always)] + pub fn guard(&mut self, guard: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.guard = Some(guard); + self + } + #[inline(always)] + pub fn mint(&mut self, mint: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { + self.instruction.mint = Some(mint); + self + } + #[inline(always)] + pub fn token_account( + &mut self, + token_account: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_account = Some(token_account); + self + } + #[inline(always)] + pub fn guard_authority( + &mut self, + guard_authority: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.guard_authority = Some(guard_authority); + self + } + #[inline(always)] + pub fn token_program( + &mut self, + token_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.token_program = Some(token_program); + self + } + #[inline(always)] + pub fn system_program( + &mut self, + system_program: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.system_program = Some(system_program); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn cpi_rule(&mut self, cpi_rule: CpiRule) -> &mut Self { + self.instruction.cpi_rule = Some(cpi_rule); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn transfer_amount_rule(&mut self, transfer_amount_rule: TransferAmountRule) -> &mut Self { + self.instruction.transfer_amount_rule = Some(transfer_amount_rule); + self + } + #[inline(always)] + pub fn additional_fields_rule( + &mut self, + additional_fields_rule: Vec, + ) -> &mut Self { + self.instruction.additional_fields_rule = Some(additional_fields_rule); + self + } + /// Add an additional account to the instruction. + #[inline(always)] + pub fn add_remaining_account( + &mut self, + account: &'b solana_program::account_info::AccountInfo<'a>, + is_writable: bool, + is_signer: bool, + ) -> &mut Self { + self.instruction + .__remaining_accounts + .push((account, is_writable, is_signer)); + self + } + /// Add additional accounts to the instruction. + /// + /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not, + /// and a `bool` indicating whether the account is a signer or not. + #[inline(always)] + pub fn add_remaining_accounts( + &mut self, + accounts: &[( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )], + ) -> &mut Self { + self.instruction + .__remaining_accounts + .extend_from_slice(accounts); + self + } + #[inline(always)] + pub fn invoke(&self) -> solana_program::entrypoint::ProgramResult { + self.invoke_signed(&[]) + } + #[allow(clippy::clone_on_copy)] + #[allow(clippy::vec_init_then_push)] + pub fn invoke_signed( + &self, + signers_seeds: &[&[&[u8]]], + ) -> solana_program::entrypoint::ProgramResult { + let args = UpdateGuardInstructionArgs { + cpi_rule: self.instruction.cpi_rule.clone(), + transfer_amount_rule: self.instruction.transfer_amount_rule.clone(), + additional_fields_rule: self + .instruction + .additional_fields_rule + .clone() + .expect("additional_fields_rule is not set"), + }; + let instruction = UpdateGuardCpi { + __program: self.instruction.__program, + + guard: self.instruction.guard.expect("guard is not set"), + + mint: self.instruction.mint.expect("mint is not set"), + + token_account: self + .instruction + .token_account + .expect("token_account is not set"), + + guard_authority: self + .instruction + .guard_authority + .expect("guard_authority is not set"), + + token_program: self + .instruction + .token_program + .expect("token_program is not set"), + + system_program: self + .instruction + .system_program + .expect("system_program is not set"), + __args: args, + }; + instruction.invoke_signed_with_remaining_accounts( + signers_seeds, + &self.instruction.__remaining_accounts, + ) + } +} + +#[derive(Clone, Debug)] +struct UpdateGuardCpiBuilderInstruction<'a, 'b> { + __program: &'b solana_program::account_info::AccountInfo<'a>, + guard: Option<&'b solana_program::account_info::AccountInfo<'a>>, + mint: Option<&'b solana_program::account_info::AccountInfo<'a>>, + token_account: Option<&'b solana_program::account_info::AccountInfo<'a>>, + guard_authority: Option<&'b solana_program::account_info::AccountInfo<'a>>, + token_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + system_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + cpi_rule: Option, + transfer_amount_rule: Option, + additional_fields_rule: Option>, + /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. + __remaining_accounts: Vec<( + &'b solana_program::account_info::AccountInfo<'a>, + bool, + bool, + )>, +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/mod.rs b/packages/renderers-rust/e2e/anchor/src/generated/mod.rs new file mode 100644 index 00000000..6050d869 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/mod.rs @@ -0,0 +1,14 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub mod accounts; +pub mod errors; +pub mod instructions; +pub mod programs; +pub mod types; + +pub(crate) use programs::*; diff --git a/packages/renderers-rust/e2e/anchor/src/generated/programs.rs b/packages/renderers-rust/e2e/anchor/src/generated/programs.rs new file mode 100644 index 00000000..bcdab852 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/programs.rs @@ -0,0 +1,11 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use solana_program::{pubkey, pubkey::Pubkey}; + +/// `wen_transfer_guard` program ID. +pub const WEN_TRANSFER_GUARD_ID: Pubkey = pubkey!("LockdqYQ9X2kwtWB99ioSbxubAmEi8o9jqYwbXgrrRw"); diff --git a/packages/renderers-rust/e2e/anchor/src/generated/types/cpi_rule.rs b/packages/renderers-rust/e2e/anchor/src/generated/types/cpi_rule.rs new file mode 100644 index 00000000..6364e879 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/types/cpi_rule.rs @@ -0,0 +1,27 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; +use solana_program::pubkey::Pubkey; + +/// Controls which protocols can interact with the token by +/// enforcing Allow and Deny lists. +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum CpiRule { + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::>") + )] + Allow(Vec), + #[cfg_attr( + feature = "serde", + serde(with = "serde_with::As::>") + )] + Deny(Vec), +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_restriction.rs b/packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_restriction.rs new file mode 100644 index 00000000..aca4ec2b --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_restriction.rs @@ -0,0 +1,19 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Inner enum for the MetadataAdditionalFieldRestriction enum. +/// * Includes - The field must include one of the values in the vector. +/// * Excludes - The field must not include any of the values in the vector. +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum MetadataAdditionalFieldRestriction { + Includes(Vec), + Excludes(Vec), +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_rule.rs b/packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_rule.rs new file mode 100644 index 00000000..f73ab01b --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/types/metadata_additional_field_rule.rs @@ -0,0 +1,19 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use crate::generated::types::MetadataAdditionalFieldRestriction; +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Enforces rules on a single additional field in the mint metadata. +/// The field must exist and the value must pass the restriction. +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct MetadataAdditionalFieldRule { + pub field: String, + pub value_restrictions: Option, +} diff --git a/packages/renderers-rust/e2e/anchor/src/generated/types/mod.rs b/packages/renderers-rust/e2e/anchor/src/generated/types/mod.rs new file mode 100644 index 00000000..124753d5 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/types/mod.rs @@ -0,0 +1,16 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +pub(crate) mod r#cpi_rule; +pub(crate) mod r#metadata_additional_field_restriction; +pub(crate) mod r#metadata_additional_field_rule; +pub(crate) mod r#transfer_amount_rule; + +pub use self::r#cpi_rule::*; +pub use self::r#metadata_additional_field_restriction::*; +pub use self::r#metadata_additional_field_rule::*; +pub use self::r#transfer_amount_rule::*; diff --git a/packages/renderers-rust/e2e/anchor/src/generated/types/transfer_amount_rule.rs b/packages/renderers-rust/e2e/anchor/src/generated/types/transfer_amount_rule.rs new file mode 100644 index 00000000..f1f4f2c9 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/generated/types/transfer_amount_rule.rs @@ -0,0 +1,20 @@ +//! This code was AUTOGENERATED using the codama library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun codama to update it. +//! +//! +//! + +use borsh::BorshDeserialize; +use borsh::BorshSerialize; + +/// Enforces rules on the amount of tokens being transferred. +/// The rules can be above, below, equal to, or within a range. +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum TransferAmountRule { + Above(u64), + Below(u64), + Equal(u64), + Rang(u64, u64), +} diff --git a/packages/renderers-rust/e2e/anchor/src/lib.rs b/packages/renderers-rust/e2e/anchor/src/lib.rs new file mode 100644 index 00000000..9974b792 --- /dev/null +++ b/packages/renderers-rust/e2e/anchor/src/lib.rs @@ -0,0 +1,4 @@ +mod generated; + +pub use generated::programs::WEN_TRANSFER_GUARD_ID as ID; +pub use generated::*; diff --git a/packages/renderers-rust/e2e/dummy/Cargo.lock b/packages/renderers-rust/e2e/dummy/Cargo.lock index 0c5a808e..2e2edea8 100644 --- a/packages/renderers-rust/e2e/dummy/Cargo.lock +++ b/packages/renderers-rust/e2e/dummy/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -564,7 +564,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -723,11 +723,11 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ - "borsh-derive 1.5.1", + "borsh-derive 1.5.3", "cfg_aliases", ] @@ -759,16 +759,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", - "syn_derive", + "syn 2.0.90", ] [[package]] @@ -884,7 +883,7 @@ checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1042,7 +1041,8 @@ version = "0.0.0" dependencies = [ "anchor-lang", "assert_matches", - "borsh 0.10.4", + "borsh 1.5.3", + "borsh-derive 1.5.3", "kaigan", "num-derive 0.3.3", "num-traits", @@ -1259,7 +1259,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1270,7 +1270,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1398,7 +1398,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1421,7 +1421,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1521,7 +1521,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1534,7 +1534,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -1692,7 +1692,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -2560,7 +2560,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -2641,7 +2641,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -2653,7 +2653,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -2834,7 +2834,7 @@ checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -2989,9 +2989,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -3013,7 +3013,7 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -3456,7 +3456,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -3533,7 +3533,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -3606,7 +3606,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -3618,7 +3618,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -3868,7 +3868,7 @@ version = "1.18.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e58fa66e1e240097665e7f87b267aa8e976ea3fcbd86918c8fd218c875395ada" dependencies = [ - "borsh 1.5.1", + "borsh 1.5.3", "futures", "solana-banks-interface", "solana-program", @@ -4101,7 +4101,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -4226,7 +4226,7 @@ dependencies = [ "blake3", "borsh 0.10.4", "borsh 0.9.3", - "borsh 1.5.1", + "borsh 1.5.3", "bs58 0.4.0", "bv", "bytemuck", @@ -4552,7 +4552,7 @@ dependencies = [ "base64 0.21.7", "bincode", "bitflags 2.6.0", - "borsh 1.5.1", + "borsh 1.5.3", "bs58 0.4.0", "bytemuck", "byteorder", @@ -4607,7 +4607,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -4949,7 +4949,7 @@ checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -4961,7 +4961,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.79", + "syn 2.0.90", "thiserror", ] @@ -5009,7 +5009,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -5192,27 +5192,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -5344,7 +5332,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -5355,7 +5343,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", "test-case-core", ] @@ -5391,7 +5379,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -5495,7 +5483,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -5658,7 +5646,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -5902,7 +5890,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", "wasm-bindgen-shared", ] @@ -5936,7 +5924,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6244,7 +6232,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] @@ -6264,7 +6252,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.90", ] [[package]] diff --git a/packages/renderers-rust/e2e/dummy/Cargo.toml b/packages/renderers-rust/e2e/dummy/Cargo.toml index f7b24012..9114eda9 100644 --- a/packages/renderers-rust/e2e/dummy/Cargo.toml +++ b/packages/renderers-rust/e2e/dummy/Cargo.toml @@ -11,7 +11,8 @@ test-sbf = [] [dependencies] anchor-lang = { version = "0.30.0", optional = true } -borsh = "^0.10" +borsh = "^1.5.3" +borsh-derive = "^1.5.3" kaigan = "0.2.5" num-derive = "^0.3" num-traits = "^0.2" diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction1.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction1.rs index ad0d5673..fbb18a6f 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction1.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction1.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction1 {} impl Instruction1 { @@ -22,7 +23,7 @@ impl Instruction1 { ) -> solana_program::instruction::Instruction { let mut accounts = Vec::with_capacity(remaining_accounts.len()); accounts.extend_from_slice(remaining_accounts); - let data = Instruction1InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction1InstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, @@ -137,7 +138,7 @@ impl<'a, 'b> Instruction1Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = Instruction1InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction1InstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction2.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction2.rs index d3e8dc3e..278d4d10 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction2.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction2.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction2 {} impl Instruction2 { @@ -22,7 +23,7 @@ impl Instruction2 { ) -> solana_program::instruction::Instruction { let mut accounts = Vec::with_capacity(remaining_accounts.len()); accounts.extend_from_slice(remaining_accounts); - let data = Instruction2InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction2InstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, @@ -137,7 +138,7 @@ impl<'a, 'b> Instruction2Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = Instruction2InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction2InstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction3.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction3.rs index 8bb1fb94..0befbe5d 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction3.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction3.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction3 {} impl Instruction3 { @@ -22,7 +23,7 @@ impl Instruction3 { ) -> solana_program::instruction::Instruction { let mut accounts = Vec::with_capacity(remaining_accounts.len()); accounts.extend_from_slice(remaining_accounts); - let data = Instruction3InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction3InstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, @@ -139,7 +140,7 @@ impl<'a, 'b> Instruction3Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = Instruction3InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction3InstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction4.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction4.rs index c18ce073..6b5d72b9 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction4.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction4.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction4 {} impl Instruction4 { @@ -26,8 +27,8 @@ impl Instruction4 { ) -> solana_program::instruction::Instruction { let mut accounts = Vec::with_capacity(remaining_accounts.len()); accounts.extend_from_slice(remaining_accounts); - let mut data = Instruction4InstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&Instruction4InstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -166,8 +167,8 @@ impl<'a, 'b> Instruction4Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = Instruction4InstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&Instruction4InstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction5.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction5.rs index c5421a4c..67fd3903 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction5.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction5.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction5 {} impl Instruction5 { @@ -26,8 +27,8 @@ impl Instruction5 { ) -> solana_program::instruction::Instruction { let mut accounts = Vec::with_capacity(remaining_accounts.len()); accounts.extend_from_slice(remaining_accounts); - let mut data = Instruction5InstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&Instruction5InstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -167,8 +168,8 @@ impl<'a, 'b> Instruction5Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = Instruction5InstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&Instruction5InstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction6.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction6.rs index 2058936d..99220484 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction6.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction6.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction6 { pub my_account: solana_program::pubkey::Pubkey, } @@ -28,7 +29,7 @@ impl Instruction6 { false, )); accounts.extend_from_slice(remaining_accounts); - let data = Instruction6InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction6InstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, @@ -169,7 +170,7 @@ impl<'a, 'b> Instruction6Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = Instruction6InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction6InstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, diff --git a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction7.rs b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction7.rs index 87cc19f0..abe4acf0 100644 --- a/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction7.rs +++ b/packages/renderers-rust/e2e/dummy/src/generated/instructions/instruction7.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Instruction7 { pub my_account: Option, } @@ -34,7 +35,7 @@ impl Instruction7 { )); } accounts.extend_from_slice(remaining_accounts); - let data = Instruction7InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction7InstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, @@ -183,7 +184,7 @@ impl<'a, 'b> Instruction7Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = Instruction7InstructionData::new().try_to_vec().unwrap(); + let data = borsh::to_vec(&Instruction7InstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::DUMMY_ID, diff --git a/packages/renderers-rust/e2e/generate-anchor.cjs b/packages/renderers-rust/e2e/generate-anchor.cjs new file mode 100644 index 00000000..66c91a54 --- /dev/null +++ b/packages/renderers-rust/e2e/generate-anchor.cjs @@ -0,0 +1,37 @@ +// #!/usr/bin/env -S node + +const path = require('node:path'); +const process = require('node:process'); + +const { rootNodeFromAnchor } = require('@codama/nodes-from-anchor'); +const { readJson } = require('@codama/renderers-core'); +const { visit } = require('@codama/visitors-core'); + +const { renderVisitor } = require('../dist/index.node.cjs'); + +async function main() { + const project = process.argv.slice(2)[0] ?? undefined; + if (project === undefined) { + throw new Error('Project name is required.'); + } + + await generateProject(project); +} + +async function generateProject(project) { + const idl = readJson(path.join(__dirname, project, 'idl.json')); + const node = rootNodeFromAnchor(idl); + + visit( + node, + renderVisitor(path.join(__dirname, project, 'src', 'generated'), { + crateFolder: path.join(__dirname, project), + formatCode: true, + }), + ); +} + +main().catch(err => { + console.error(err); + process.exit(1); +}); diff --git a/packages/renderers-rust/e2e/memo/Cargo.lock b/packages/renderers-rust/e2e/memo/Cargo.lock index f08a3425..74c1393b 100644 --- a/packages/renderers-rust/e2e/memo/Cargo.lock +++ b/packages/renderers-rust/e2e/memo/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -552,7 +552,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -711,11 +711,11 @@ dependencies = [ [[package]] name = "borsh" -version = "1.4.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0901fc8eb0aca4c83be0106d6f2db17d86a08dfc2c25f0e84464bf381158add6" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ - "borsh-derive 1.4.0", + "borsh-derive 1.5.3", "cfg_aliases", ] @@ -747,16 +747,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.4.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51670c3aa053938b0ee3bd67c3817e471e626151131b934038e83c5bf8de48f5" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.60", - "syn_derive", + "syn 2.0.90", ] [[package]] @@ -872,7 +871,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -947,9 +946,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" @@ -1030,7 +1029,8 @@ version = "0.0.0" dependencies = [ "anchor-lang", "assert_matches", - "borsh 0.10.3", + "borsh 1.5.3", + "borsh-derive 1.5.3", "kaigan", "num-derive 0.3.3", "num-traits", @@ -1247,7 +1247,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1258,7 +1258,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1386,7 +1386,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1409,7 +1409,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1509,7 +1509,7 @@ checksum = "c19cbb53d33b57ac4df1f0af6b92c38c107cded663c4aea9fae1189dcfc17cf5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1522,7 +1522,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1680,7 +1680,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2532,7 +2532,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2613,7 +2613,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2625,7 +2625,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2806,7 +2806,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2958,9 +2958,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2982,7 +2982,7 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3434,7 +3434,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3511,7 +3511,7 @@ checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3583,7 +3583,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3595,7 +3595,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3839,7 +3839,7 @@ version = "1.18.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13a4cbe27e78987b706caf90cbd16da9da3955c09a660b8107a96c2cb32f1124" dependencies = [ - "borsh 1.4.0", + "borsh 1.5.3", "futures", "solana-banks-interface", "solana-program", @@ -4072,7 +4072,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -4197,7 +4197,7 @@ dependencies = [ "blake3", "borsh 0.10.3", "borsh 0.9.3", - "borsh 1.4.0", + "borsh 1.5.3", "bs58 0.4.0", "bv", "bytemuck", @@ -4523,7 +4523,7 @@ dependencies = [ "base64 0.21.7", "bincode", "bitflags 2.5.0", - "borsh 1.4.0", + "borsh 1.5.3", "bs58 0.4.0", "bytemuck", "byteorder", @@ -4578,7 +4578,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -4920,7 +4920,7 @@ checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -4932,7 +4932,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.60", + "syn 2.0.90", "thiserror", ] @@ -4980,7 +4980,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5157,27 +5157,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -5308,7 +5296,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5319,7 +5307,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", "test-case-core", ] @@ -5355,7 +5343,7 @@ checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5460,7 +5448,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5635,7 +5623,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5878,7 +5866,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", "wasm-bindgen-shared", ] @@ -5912,7 +5900,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6210,7 +6198,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -6230,7 +6218,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] diff --git a/packages/renderers-rust/e2e/memo/Cargo.toml b/packages/renderers-rust/e2e/memo/Cargo.toml index 8eeaff5a..ee08a8e5 100644 --- a/packages/renderers-rust/e2e/memo/Cargo.toml +++ b/packages/renderers-rust/e2e/memo/Cargo.toml @@ -11,7 +11,8 @@ test-sbf = [] [dependencies] anchor-lang = { version = "0.30.0", optional = true } -borsh = "^0.10" +borsh = "^1.5.3" +borsh-derive = "^1.5.3" kaigan = "0.2.5" num-derive = "^0.3" num-traits = "^0.2" diff --git a/packages/renderers-rust/e2e/memo/src/generated/instructions/add_memo.rs b/packages/renderers-rust/e2e/memo/src/generated/instructions/add_memo.rs index 5f3c1a41..124a3ac5 100644 --- a/packages/renderers-rust/e2e/memo/src/generated/instructions/add_memo.rs +++ b/packages/renderers-rust/e2e/memo/src/generated/instructions/add_memo.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use kaigan::types::RemainderStr; /// Accounts. +#[derive(Debug)] pub struct AddMemo {} impl AddMemo { @@ -27,8 +28,8 @@ impl AddMemo { ) -> solana_program::instruction::Instruction { let mut accounts = Vec::with_capacity(remaining_accounts.len()); accounts.extend_from_slice(remaining_accounts); - let mut data = AddMemoInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AddMemoInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -167,8 +168,8 @@ impl<'a, 'b> AddMemoCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = AddMemoInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AddMemoInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/Cargo.lock b/packages/renderers-rust/e2e/system/Cargo.lock index e1c8ff34..9e7d65a9 100644 --- a/packages/renderers-rust/e2e/system/Cargo.lock +++ b/packages/renderers-rust/e2e/system/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "Inflector" @@ -552,7 +552,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -711,11 +711,11 @@ dependencies = [ [[package]] name = "borsh" -version = "1.4.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0901fc8eb0aca4c83be0106d6f2db17d86a08dfc2c25f0e84464bf381158add6" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ - "borsh-derive 1.4.0", + "borsh-derive 1.5.3", "cfg_aliases", ] @@ -747,16 +747,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.4.0" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51670c3aa053938b0ee3bd67c3817e471e626151131b934038e83c5bf8de48f5" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.60", - "syn_derive", + "syn 2.0.90", ] [[package]] @@ -872,7 +871,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -947,9 +946,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cfg_aliases" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" @@ -1030,7 +1029,8 @@ version = "0.0.0" dependencies = [ "anchor-lang", "assert_matches", - "borsh 0.10.3", + "borsh 1.5.3", + "borsh-derive 1.5.3", "num-derive 0.3.3", "num-traits", "serde", @@ -1246,7 +1246,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1257,7 +1257,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1385,7 +1385,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1408,7 +1408,7 @@ checksum = "a6cbae11b3de8fce2a456e8ea3dada226b35fe791f0dc1d360c0941f0bb681f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1508,7 +1508,7 @@ checksum = "c19cbb53d33b57ac4df1f0af6b92c38c107cded663c4aea9fae1189dcfc17cf5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1521,7 +1521,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -1679,7 +1679,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2522,7 +2522,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2603,7 +2603,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2615,7 +2615,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2796,7 +2796,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -2948,9 +2948,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2972,7 +2972,7 @@ checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3424,7 +3424,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3501,7 +3501,7 @@ checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3573,7 +3573,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3585,7 +3585,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -3829,7 +3829,7 @@ version = "1.18.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13a4cbe27e78987b706caf90cbd16da9da3955c09a660b8107a96c2cb32f1124" dependencies = [ - "borsh 1.4.0", + "borsh 1.5.3", "futures", "solana-banks-interface", "solana-program", @@ -4062,7 +4062,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -4187,7 +4187,7 @@ dependencies = [ "blake3", "borsh 0.10.3", "borsh 0.9.3", - "borsh 1.4.0", + "borsh 1.5.3", "bs58 0.4.0", "bv", "bytemuck", @@ -4513,7 +4513,7 @@ dependencies = [ "base64 0.21.7", "bincode", "bitflags 2.5.0", - "borsh 1.4.0", + "borsh 1.5.3", "bs58 0.4.0", "bytemuck", "byteorder", @@ -4568,7 +4568,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -4910,7 +4910,7 @@ checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -4922,7 +4922,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.60", + "syn 2.0.90", "thiserror", ] @@ -4970,7 +4970,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5147,27 +5147,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "syn_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "sync_wrapper" version = "0.1.2" @@ -5298,7 +5286,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5309,7 +5297,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", "test-case-core", ] @@ -5345,7 +5333,7 @@ checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5450,7 +5438,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5625,7 +5613,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -5868,7 +5856,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", "wasm-bindgen-shared", ] @@ -5902,7 +5890,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6200,7 +6188,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] @@ -6220,7 +6208,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.90", ] [[package]] diff --git a/packages/renderers-rust/e2e/system/Cargo.toml b/packages/renderers-rust/e2e/system/Cargo.toml index 6415ef89..b78c5206 100644 --- a/packages/renderers-rust/e2e/system/Cargo.toml +++ b/packages/renderers-rust/e2e/system/Cargo.toml @@ -11,7 +11,8 @@ test-sbf = [] [dependencies] anchor-lang = { version = "0.30.0", optional = true } -borsh = "^0.10" +borsh = "^1.5.3" +borsh-derive = "^1.5.3" num-derive = "^0.3" num-traits = "^0.2" serde = { version = "^1.0", features = ["derive"], optional = true } diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/advance_nonce_account.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/advance_nonce_account.rs index 51cfc8e2..ade03f09 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/advance_nonce_account.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/advance_nonce_account.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct AdvanceNonceAccount { pub nonce_account: solana_program::pubkey::Pubkey, @@ -40,9 +41,7 @@ impl AdvanceNonceAccount { true, )); accounts.extend_from_slice(remaining_accounts); - let data = AdvanceNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); + let data = borsh::to_vec(&AdvanceNonceAccountInstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::SYSTEM_ID, @@ -228,9 +227,7 @@ impl<'a, 'b> AdvanceNonceAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = AdvanceNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); + let data = borsh::to_vec(&AdvanceNonceAccountInstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::SYSTEM_ID, diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/allocate.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/allocate.rs index a7cdfc64..4cda14dc 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/allocate.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/allocate.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct Allocate { pub new_account: solana_program::pubkey::Pubkey, } @@ -32,8 +33,8 @@ impl Allocate { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = AllocateInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AllocateInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -196,8 +197,8 @@ impl<'a, 'b> AllocateCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = AllocateInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AllocateInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/allocate_with_seed.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/allocate_with_seed.rs index 5ce997a3..271f6595 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/allocate_with_seed.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/allocate_with_seed.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct AllocateWithSeed { pub new_account: solana_program::pubkey::Pubkey, @@ -39,8 +40,8 @@ impl AllocateWithSeed { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = AllocateWithSeedInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AllocateWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -247,8 +248,8 @@ impl<'a, 'b> AllocateWithSeedCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = AllocateWithSeedInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AllocateWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/assign.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/assign.rs index 88551bd1..95383fce 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/assign.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/assign.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct Assign { pub account: solana_program::pubkey::Pubkey, } @@ -33,8 +34,8 @@ impl Assign { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = AssignInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AssignInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -200,8 +201,8 @@ impl<'a, 'b> AssignCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = AssignInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AssignInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/assign_with_seed.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/assign_with_seed.rs index 9a237f3d..9d9a965a 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/assign_with_seed.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/assign_with_seed.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct AssignWithSeed { pub account: solana_program::pubkey::Pubkey, @@ -39,8 +40,8 @@ impl AssignWithSeed { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = AssignWithSeedInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AssignWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -239,8 +240,8 @@ impl<'a, 'b> AssignWithSeedCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = AssignWithSeedInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AssignWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/authorize_nonce_account.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/authorize_nonce_account.rs index 8d3c715f..0dac7c7a 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/authorize_nonce_account.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/authorize_nonce_account.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct AuthorizeNonceAccount { pub nonce_account: solana_program::pubkey::Pubkey, @@ -39,10 +40,8 @@ impl AuthorizeNonceAccount { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = AuthorizeNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AuthorizeNonceAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -228,10 +227,8 @@ impl<'a, 'b> AuthorizeNonceAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = AuthorizeNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&AuthorizeNonceAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/create_account.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/create_account.rs index 6f7cd2e3..1091cd84 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/create_account.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/create_account.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct CreateAccount { pub payer: solana_program::pubkey::Pubkey, @@ -38,8 +39,8 @@ impl CreateAccount { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = CreateAccountInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&CreateAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -238,8 +239,8 @@ impl<'a, 'b> CreateAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = CreateAccountInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&CreateAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/create_account_with_seed.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/create_account_with_seed.rs index 8e4b906d..61e4a5d8 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/create_account_with_seed.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/create_account_with_seed.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct CreateAccountWithSeed { pub payer: solana_program::pubkey::Pubkey, @@ -44,10 +45,8 @@ impl CreateAccountWithSeed { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = CreateAccountWithSeedInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&CreateAccountWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -279,10 +278,8 @@ impl<'a, 'b> CreateAccountWithSeedCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = CreateAccountWithSeedInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&CreateAccountWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/initialize_nonce_account.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/initialize_nonce_account.rs index f4afcc73..d2af149b 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/initialize_nonce_account.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/initialize_nonce_account.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct InitializeNonceAccount { pub nonce_account: solana_program::pubkey::Pubkey, @@ -45,10 +46,8 @@ impl InitializeNonceAccount { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = InitializeNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&InitializeNonceAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -257,10 +256,8 @@ impl<'a, 'b> InitializeNonceAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = InitializeNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&InitializeNonceAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol.rs index 05ac91f0..6c7415c3 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct TransferSol { pub source: solana_program::pubkey::Pubkey, @@ -38,8 +39,8 @@ impl TransferSol { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = TransferSolInstructionData::new().try_to_vec().unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&TransferSolInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -219,8 +220,8 @@ impl<'a, 'b> TransferSolCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = TransferSolInstructionData::new().try_to_vec().unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&TransferSolInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol_with_seed.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol_with_seed.rs index 373c3ed6..297bf57c 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol_with_seed.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/transfer_sol_with_seed.rs @@ -10,6 +10,7 @@ use borsh::BorshSerialize; use solana_program::pubkey::Pubkey; /// Accounts. +#[derive(Debug)] pub struct TransferSolWithSeed { pub source: solana_program::pubkey::Pubkey, @@ -45,10 +46,8 @@ impl TransferSolWithSeed { false, )); accounts.extend_from_slice(remaining_accounts); - let mut data = TransferSolWithSeedInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&TransferSolWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -261,10 +260,8 @@ impl<'a, 'b> TransferSolWithSeedCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = TransferSolWithSeedInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&TransferSolWithSeedInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/upgrade_nonce_account.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/upgrade_nonce_account.rs index dd987d4f..67bb0ae0 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/upgrade_nonce_account.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/upgrade_nonce_account.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct UpgradeNonceAccount { pub nonce_account: solana_program::pubkey::Pubkey, } @@ -28,9 +29,7 @@ impl UpgradeNonceAccount { false, )); accounts.extend_from_slice(remaining_accounts); - let data = UpgradeNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); + let data = borsh::to_vec(&UpgradeNonceAccountInstructionData::new()).unwrap(); solana_program::instruction::Instruction { program_id: crate::SYSTEM_ID, @@ -173,9 +172,7 @@ impl<'a, 'b> UpgradeNonceAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let data = UpgradeNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); + let data = borsh::to_vec(&UpgradeNonceAccountInstructionData::new()).unwrap(); let instruction = solana_program::instruction::Instruction { program_id: crate::SYSTEM_ID, diff --git a/packages/renderers-rust/e2e/system/src/generated/instructions/withdraw_nonce_account.rs b/packages/renderers-rust/e2e/system/src/generated/instructions/withdraw_nonce_account.rs index 122d79cb..d2dc7758 100644 --- a/packages/renderers-rust/e2e/system/src/generated/instructions/withdraw_nonce_account.rs +++ b/packages/renderers-rust/e2e/system/src/generated/instructions/withdraw_nonce_account.rs @@ -9,6 +9,7 @@ use borsh::BorshDeserialize; use borsh::BorshSerialize; /// Accounts. +#[derive(Debug)] pub struct WithdrawNonceAccount { pub nonce_account: solana_program::pubkey::Pubkey, @@ -56,10 +57,8 @@ impl WithdrawNonceAccount { true, )); accounts.extend_from_slice(remaining_accounts); - let mut data = WithdrawNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&WithdrawNonceAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); solana_program::instruction::Instruction { @@ -310,10 +309,8 @@ impl<'a, 'b> WithdrawNonceAccountCpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let mut data = WithdrawNonceAccountInstructionData::new() - .try_to_vec() - .unwrap(); - let mut args = self.__args.try_to_vec().unwrap(); + let mut data = borsh::to_vec(&WithdrawNonceAccountInstructionData::new()).unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); let instruction = solana_program::instruction::Instruction { diff --git a/packages/renderers-rust/package.json b/packages/renderers-rust/package.json index 85474105..af3b51bd 100644 --- a/packages/renderers-rust/package.json +++ b/packages/renderers-rust/package.json @@ -46,6 +46,7 @@ "@codama/nodes": "workspace:*", "@codama/renderers-core": "workspace:*", "@codama/visitors-core": "workspace:*", + "@codama/nodes-from-anchor": "workspace:*", "@solana/codecs-strings": "rc", "nunjucks": "^3.2.4" }, diff --git a/packages/renderers-rust/public/templates/instructionsCpiPage.njk b/packages/renderers-rust/public/templates/instructionsCpiPage.njk index 68bb584b..86bef7e8 100644 --- a/packages/renderers-rust/public/templates/instructionsCpiPage.njk +++ b/packages/renderers-rust/public/templates/instructionsCpiPage.njk @@ -150,9 +150,9 @@ impl<'a, 'b> {{ instruction.name | pascalCase }}Cpi<'a, 'b> { is_writable: remaining_account.2, }) }); - let {{ 'mut ' if hasArgs }}data = {{ instruction.name | pascalCase }}InstructionData::new().try_to_vec().unwrap(); + let {{ 'mut ' if hasArgs }}data = borsh::to_vec(&{{ instruction.name | pascalCase }}InstructionData::new()).unwrap(); {% if hasArgs %} - let mut args = self.__args.try_to_vec().unwrap(); + let mut args = borsh::to_vec(&self.__args).unwrap(); data.append(&mut args); {% endif %} diff --git a/packages/renderers-rust/public/templates/instructionsPage.njk b/packages/renderers-rust/public/templates/instructionsPage.njk index 355c65cc..af6312a5 100644 --- a/packages/renderers-rust/public/templates/instructionsPage.njk +++ b/packages/renderers-rust/public/templates/instructionsPage.njk @@ -6,6 +6,7 @@ {{ imports }} /// Accounts. +#[derive(Debug)] pub struct {{ instruction.name | pascalCase }} { {% for account in instruction.accounts %} {% if account.docs.length > 0 %} @@ -93,9 +94,9 @@ impl {{ instruction.name | pascalCase }} { {% endif %} {% endfor %} accounts.extend_from_slice(remaining_accounts); - let {{ 'mut ' if hasArgs }}data = {{ instruction.name | pascalCase }}InstructionData::new().try_to_vec().unwrap(); + let {{ 'mut ' if hasArgs }}data = borsh::to_vec(&{{ instruction.name | pascalCase }}InstructionData::new()).unwrap(); {% if hasArgs %} - let mut args = args.try_to_vec().unwrap(); + let mut args = borsh::to_vec(&args).unwrap(); data.append(&mut args); {% endif %} diff --git a/packages/renderers-vixen-parser/e2e/system/Cargo.lock b/packages/renderers-vixen-parser/e2e/anchor_parser/Cargo.lock similarity index 80% rename from packages/renderers-vixen-parser/e2e/system/Cargo.lock rename to packages/renderers-vixen-parser/e2e/anchor_parser/Cargo.lock index e7324ceb..bac77995 100644 --- a/packages/renderers-vixen-parser/e2e/system/Cargo.lock +++ b/packages/renderers-vixen-parser/e2e/anchor_parser/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -28,6 +28,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -43,6 +55,123 @@ version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -177,6 +306,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -197,6 +332,18 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] [[package]] name = "blake3" @@ -230,6 +377,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + [[package]] name = "borsh" version = "0.10.4" @@ -237,7 +394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" dependencies = [ "borsh-derive 0.10.4", - "hashbrown 0.12.3", + "hashbrown 0.13.2", ] [[package]] @@ -250,14 +407,27 @@ dependencies = [ "cfg_aliases", ] +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "borsh-derive" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", + "borsh-derive-internal 0.10.4", + "borsh-schema-derive-internal 0.10.4", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -276,6 +446,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-derive-internal" version = "0.10.4" @@ -287,6 +468,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-schema-derive-internal" version = "0.10.4" @@ -298,6 +490,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bs58" version = "0.5.1" @@ -328,6 +526,9 @@ name = "bytemuck" version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +dependencies = [ + "bytemuck_derive", +] [[package]] name = "bytemuck_derive" @@ -358,6 +559,8 @@ version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -374,11 +577,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] -name = "codama-renderers-vixen-parser-e2e-system" +name = "codama-renderers-rust-e2e-anchor" +version = "0.0.0" +dependencies = [ + "borsh 1.5.3", + "borsh-derive 1.5.3", + "kaigan", + "num-derive 0.3.3", + "num-traits", + "solana-program 1.18.26", + "thiserror", +] + +[[package]] +name = "codama-renderers-vixen-parser-e2e-anchor" version = "0.0.0" dependencies = [ "borsh 1.5.3", - "solana-program", + "codama-renderers-rust-e2e-anchor", + "solana-program 2.1.6", "yellowstone-vixen-core", ] @@ -417,6 +634,31 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.2" @@ -433,6 +675,30 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "serde", + "subtle", + "zeroize", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -461,6 +727,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.9.0" @@ -593,6 +870,7 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", ] @@ -604,8 +882,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -646,13 +926,28 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.8", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash", + "ahash 0.8.11", ] [[package]] @@ -667,6 +962,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + [[package]] name = "http" version = "1.2.0" @@ -766,6 +1082,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -786,6 +1118,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -801,6 +1142,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.76" @@ -811,6 +1161,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kaigan" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6dd100976df9dd59d0c3fecf6f9ad3f161a087374d1b2a77ebb4ad8920f11bb" +dependencies = [ + "borsh 0.10.4", +] + [[package]] name = "keccak" version = "0.1.5" @@ -841,12 +1200,14 @@ dependencies = [ "arrayref", "base64 0.12.3", "digest 0.9.0", + "hmac-drbg", "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", "rand 0.7.3", "serde", "sha2 0.9.9", + "typenum", ] [[package]] @@ -878,6 +1239,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint", + "thiserror", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -912,6 +1285,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.9.1" @@ -963,6 +1345,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num-derive" version = "0.4.2" @@ -1036,6 +1429,21 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1147,7 +1555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" dependencies = [ "heck", - "itertools", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1167,7 +1575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.90", @@ -1271,6 +1679,35 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.8" @@ -1315,6 +1752,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1343,6 +1786,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + [[package]] name = "scopeguard" version = "1.2.0" @@ -1384,6 +1833,18 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1424,6 +1885,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -1500,7 +1971,7 @@ checksum = "b26a68f89972fddb370ba33a49340bd3419da529893d9ee851211588aee811fa" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1541,7 +2012,7 @@ checksum = "c60dde3613fcd1af91c2033e67ffe8c8d2bcd58085c53c842fa7903fa839ad38" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1556,6 +2027,43 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "solana-frozen-abi" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ab2c30c15311b511c0d1151e4ab6bc9a3e080a37e7c6e7c2d96f5784cf9434" +dependencies = [ + "block-buffer 0.10.4", + "bs58 0.4.0", + "bv", + "either", + "generic-array", + "im", + "lazy_static", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_bytes", + "serde_derive", + "sha2 0.10.8", + "solana-frozen-abi-macro", + "subtle", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142f779c3633ac83c84d04ff06c70e1f558c876f13358bed77ba629c7417932" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.90", +] + [[package]] name = "solana-hash" version = "2.1.6" @@ -1563,7 +2071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a86aabbd7ebf807689a0355f053d6dc31d2131c2d83613011a374a18cc5d61b7" dependencies = [ "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", "js-sys", @@ -1600,7 +2108,7 @@ checksum = "bd5647af0980c796c942e33f1f7dbffca29b7747630b720e6975abb1d7c531f6" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1619,6 +2127,61 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa3c5006bbea99b810ad8fc6ae168fc83891b607a13a9aa6be39db71a700f87" +[[package]] +name = "solana-program" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10f4588cefd716b24a1a40dd32c278e43a560ab8ce4de6b5805c9d113afdfa1" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "base64 0.21.7", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.4", + "borsh 0.9.3", + "borsh 1.5.3", + "bs58 0.4.0", + "bv", + "bytemuck", + "cc", + "console_error_panic_hook", + "console_log", + "curve25519-dalek 3.2.1", + "getrandom 0.2.15", + "itertools 0.10.5", + "js-sys", + "lazy_static", + "libc", + "libsecp256k1", + "light-poseidon", + "log", + "memoffset", + "num-bigint", + "num-derive 0.4.2", + "num-traits", + "parking_lot", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.8", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro 1.18.26", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "solana-program" version = "2.1.6" @@ -1631,13 +2194,13 @@ dependencies = [ "blake3", "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bv", "bytemuck", "bytemuck_derive", "console_error_panic_hook", "console_log", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1645,7 +2208,7 @@ dependencies = [ "log", "memoffset", "num-bigint", - "num-derive", + "num-derive 0.4.2", "num-traits", "parking_lot", "rand 0.8.5", @@ -1677,7 +2240,7 @@ dependencies = [ "solana-pubkey", "solana-rent", "solana-sanitize", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-secp256k1-recover", "solana-serde-varint", "solana-serialize-utils", @@ -1753,10 +2316,10 @@ checksum = "a954fba3af498201179981818b0ed61f95c32b4a3db5ea9cc042c971c84cdeae" dependencies = [ "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1779,7 +2342,7 @@ checksum = "4ebcc59bff8b3c773214545d038b718a3e2e63c920b8172f85725463029f7f00" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1789,13 +2352,26 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05ecd7ec442abf0561cbf06984484d6368e71a4882213bfa68b658b0f8d6a0e" +[[package]] +name = "solana-sdk-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b75d0f193a27719257af19144fdaebec0415d1c9e9226ae4bd29b791be5e9bd" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.90", +] + [[package]] name = "solana-sdk-macro" version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85df4723291cfec8ffe9dadc59d565afcae12ea9a6460b7b28c4da21c2c4a887" dependencies = [ - "bs58", + "bs58 0.5.1", "proc-macro2", "quote", "syn 2.0.90", @@ -1972,6 +2548,25 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac", + "once_cell", + "pbkdf2", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2203,6 +2798,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "version_check" version = "0.9.5" @@ -2404,7 +3008,7 @@ name = "yellowstone-vixen-core" version = "0.0.0" source = "git+https://github.com/rpcpool/yellowstone-vixen?branch=main#4b61e848d19f117125a36a5bd38968da1d5ad94d" dependencies = [ - "bs58", + "bs58 0.5.1", "thiserror", "yellowstone-grpc-proto", ] @@ -2432,6 +3036,20 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] diff --git a/packages/renderers-vixen-parser/e2e/anchor/Cargo.toml b/packages/renderers-vixen-parser/e2e/anchor_parser/Cargo.toml similarity index 75% rename from packages/renderers-vixen-parser/e2e/anchor/Cargo.toml rename to packages/renderers-vixen-parser/e2e/anchor_parser/Cargo.toml index 9789fbd6..6a2f8059 100644 --- a/packages/renderers-vixen-parser/e2e/anchor/Cargo.toml +++ b/packages/renderers-vixen-parser/e2e/anchor_parser/Cargo.toml @@ -7,4 +7,5 @@ edition = "2021" [dependencies] yellowstone-vixen-core = { git = "https://github.com/rpcpool/yellowstone-vixen", branch = "main" } solana-program = "^2.1.6" +codama-renderers-rust-e2e-anchor = { path = "../../../renderers-rust/e2e/anchor" } borsh = "^1.5.3" diff --git a/packages/renderers-vixen-parser/e2e/anchor_parser/idl.json b/packages/renderers-vixen-parser/e2e/anchor_parser/idl.json new file mode 100644 index 00000000..a8162bb1 --- /dev/null +++ b/packages/renderers-vixen-parser/e2e/anchor_parser/idl.json @@ -0,0 +1,640 @@ +{ + "address": "LockdqYQ9X2kwtWB99ioSbxubAmEi8o9jqYwbXgrrRw", + "metadata": { + "name": "wen_transfer_guard", + "version": "0.1.0", + "spec": "0.1.0", + "description": "A generic transfer hook implementation for Token Extensions" + }, + "instructions": [ + { + "name": "create_guard", + "discriminator": [251, 254, 17, 198, 219, 218, 154, 99], + "accounts": [ + { + "name": "guard", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, 101, 110, 95, 116, 111, 107, 101, 110, 95, 116, 114, 97, 110, 115, 102, 101, + 114, 95, 103, 117, 97, 114, 100 + ] + }, + { + "kind": "const", + "value": [103, 117, 97, 114, 100, 95, 118, 49] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "mint", + "writable": true, + "signer": true + }, + { + "name": "mint_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "guard_authority" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "guard_authority", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "token_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "CreateGuardArgs" + } + } + } + ] + }, + { + "name": "execute", + "discriminator": [105, 37, 101, 197, 75, 251, 102, 26], + "accounts": [ + { + "name": "source_account" + }, + { + "name": "mint" + }, + { + "name": "destination_account" + }, + { + "name": "owner_delegate" + }, + { + "name": "extra_metas_account", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 101, 120, 116, 114, 97, 45, 97, 99, 99, 111, 117, 110, 116, 45, 109, 101, 116, 97, + 115 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "guard", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, 101, 110, 95, 116, 111, 107, 101, 110, 95, 116, 114, 97, 110, 115, 102, 101, + 114, 95, 103, 117, 97, 114, 100 + ] + }, + { + "kind": "const", + "value": [103, 117, 97, 114, 100, 95, 118, 49] + }, + { + "kind": "account", + "path": "guard.mint", + "account": "GuardV1" + } + ] + } + }, + { + "name": "instruction_sysvar_account", + "address": "Sysvar1nstructions1111111111111111111111111" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "initialize", + "discriminator": [43, 34, 13, 49, 167, 88, 235, 235], + "accounts": [ + { + "name": "extra_metas_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 101, 120, 116, 114, 97, 45, 97, 99, 99, 111, 117, 110, 116, 45, 109, 101, 116, 97, + 115 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "guard", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, 101, 110, 95, 116, 111, 107, 101, 110, 95, 116, 114, 97, 110, 115, 102, 101, + 114, 95, 103, 117, 97, 114, 100 + ] + }, + { + "kind": "const", + "value": [103, 117, 97, 114, 100, 95, 118, 49] + }, + { + "kind": "account", + "path": "guard.mint", + "account": "GuardV1" + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "transfer_hook_authority", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "payer", + "writable": true, + "signer": true + } + ], + "args": [] + }, + { + "name": "update_guard", + "discriminator": [51, 38, 175, 180, 25, 249, 39, 24], + "accounts": [ + { + "name": "guard", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, 101, 110, 95, 116, 111, 107, 101, 110, 95, 116, 114, 97, 110, 115, 102, 101, + 114, 95, 103, 117, 97, 114, 100 + ] + }, + { + "kind": "const", + "value": [103, 117, 97, 114, 100, 95, 118, 49] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "mint" + }, + { + "name": "token_account", + "pda": { + "seeds": [ + { + "kind": "account", + "path": "guard_authority" + }, + { + "kind": "account", + "path": "token_program" + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, + 218, 255, 16, 132, 4, 142, 123, 216, 219, 233, 248, 89 + ] + } + } + }, + { + "name": "guard_authority", + "signer": true + }, + { + "name": "token_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "UpdateGuardArgs" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "GuardV1", + "discriminator": [185, 149, 156, 78, 245, 108, 172, 68] + } + ], + "errors": [ + { + "code": 6000, + "name": "CpiRuleEnforcementFailed", + "msg": "Cpi Rule Enforcement Failed" + }, + { + "code": 6001, + "name": "TransferAmountRuleEnforceFailed", + "msg": "Transfer Amount Rule Enforce Failed" + }, + { + "code": 6002, + "name": "MetadataFieldDoesNotExist", + "msg": "Metadata Field Does Not Exist" + }, + { + "code": 6003, + "name": "MetadataFieldDoesNotPass", + "msg": "Metadata Field Does Not Pass" + }, + { + "code": 6004, + "name": "GuardTokenAmountShouldBeAtLeastOne", + "msg": "Guard token amount should be at least 1" + }, + { + "code": 6005, + "name": "NotOwnedByToken2022Program", + "msg": "Not owned by token 2022 program" + }, + { + "code": 6006, + "name": "MustBeInitializedByTransferHookAuthority", + "msg": "Must be initialized by Transfer Hook Authority" + }, + { + "code": 6007, + "name": "MintAssignedTransferHookProgramIsNotThisOne", + "msg": "Mint's assigned Transfer Hook Program is not this one" + } + ], + "types": [ + { + "name": "CpiRule", + "docs": ["Controls which protocols can interact with the token by", "enforcing Allow and Deny lists."], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Allow", + "fields": [ + { + "vec": "pubkey" + } + ] + }, + { + "name": "Deny", + "fields": [ + { + "vec": "pubkey" + } + ] + } + ] + } + }, + { + "name": "CreateGuardArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "cpi_rule", + "type": { + "option": { + "defined": { + "name": "CpiRule" + } + } + } + }, + { + "name": "transfer_amount_rule", + "type": { + "option": { + "defined": { + "name": "TransferAmountRule" + } + } + } + }, + { + "name": "additional_fields_rule", + "type": { + "vec": { + "defined": { + "name": "MetadataAdditionalFieldRule" + } + } + } + } + ] + } + }, + { + "name": "GuardV1", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "docs": [ + "Mint token representing the guard, do not confuse with the mint of the token being transferred." + ], + "type": "pubkey" + }, + { + "name": "bump", + "docs": ["Bump seed for the guard account."], + "type": "u8" + }, + { + "name": "cpi_rule", + "docs": ["CPI ruleset for the guard."], + "type": { + "option": { + "defined": { + "name": "CpiRule" + } + } + } + }, + { + "name": "transfer_amount_rule", + "docs": ["Transfer amount ruleset for the guard."], + "type": { + "option": { + "defined": { + "name": "TransferAmountRule" + } + } + } + }, + { + "name": "additional_fields_rule", + "docs": ["Additional fields ruleset for the guard."], + "type": { + "vec": { + "defined": { + "name": "MetadataAdditionalFieldRule" + } + } + } + } + ] + } + }, + { + "name": "MetadataAdditionalFieldRestriction", + "docs": [ + "Inner enum for the MetadataAdditionalFieldRestriction enum.", + "* Includes - The field must include one of the values in the vector.", + "* Excludes - The field must not include any of the values in the vector." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Includes", + "fields": [ + { + "vec": "string" + } + ] + }, + { + "name": "Excludes", + "fields": [ + { + "vec": "string" + } + ] + } + ] + } + }, + { + "name": "MetadataAdditionalFieldRule", + "docs": [ + "Enforces rules on a single additional field in the mint metadata.", + "The field must exist and the value must pass the restriction." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "field", + "type": "string" + }, + { + "name": "value_restrictions", + "type": { + "option": { + "defined": { + "name": "MetadataAdditionalFieldRestriction" + } + } + } + } + ] + } + }, + { + "name": "TransferAmountRule", + "docs": [ + "Enforces rules on the amount of tokens being transferred.", + "The rules can be above, below, equal to, or within a range." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Above", + "fields": ["u64"] + }, + { + "name": "Below", + "fields": ["u64"] + }, + { + "name": "Equal", + "fields": ["u64"] + }, + { + "name": "Rang", + "fields": ["u64", "u64"] + } + ] + } + }, + { + "name": "UpdateGuardArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "cpi_rule", + "type": { + "option": { + "defined": { + "name": "CpiRule" + } + } + } + }, + { + "name": "transfer_amount_rule", + "type": { + "option": { + "defined": { + "name": "TransferAmountRule" + } + } + } + }, + { + "name": "additional_fields_rule", + "type": { + "vec": { + "defined": { + "name": "MetadataAdditionalFieldRule" + } + } + } + } + ] + } + } + ], + "constants": [ + { + "name": "EXTRA_ACCOUNT_METAS", + "type": { + "array": ["u8", 19] + }, + "value": "[101, 120, 116, 114, 97, 45, 97, 99, 99, 111, 117, 110, 116, 45, 109, 101, 116, 97, 115]" + }, + { + "name": "GUARD_V1", + "type": { + "array": ["u8", 8] + }, + "value": "[103, 117, 97, 114, 100, 95, 118, 49]" + }, + { + "name": "WEN_TOKEN_GUARD", + "type": { + "array": ["u8", 24] + }, + "value": "[119, 101, 110, 95, 116, 111, 107, 101, 110, 95, 116, 114, 97, 110, 115, 102, 101, 114, 95, 103, 117, 97, 114, 100]" + } + ] +} diff --git a/packages/renderers-vixen-parser/e2e/anchor/src/generated/accounts_parser.rs b/packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/accounts_parser.rs similarity index 87% rename from packages/renderers-vixen-parser/e2e/anchor/src/generated/accounts_parser.rs rename to packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/accounts_parser.rs index 7f45e94a..2d9bcfee 100644 --- a/packages/renderers-vixen-parser/e2e/anchor/src/generated/accounts_parser.rs +++ b/packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/accounts_parser.rs @@ -5,8 +5,8 @@ //! //! -use wen_transfer_guard_program_sdk::accounts::guard_v1::GuardV1; -use wen_transfer_guard_program_sdk::ID; +use codama_renderers_rust_e2e_anchor::accounts::GuardV1; +use codama_renderers_rust_e2e_anchor::ID; /// WenTransferGuard Program State #[allow(clippy::large_enum_variant)] @@ -18,8 +18,9 @@ pub enum WenTransferGuardProgramState { impl WenTransferGuardProgramState { pub fn try_unpack(data_bytes: &[u8]) -> yellowstone_vixen_core::ParseResult { let data_len = data_bytes.len(); + const GUARDV1_LEN: usize = std::mem::size_of::(); match data_len { - GuardV1::LEN => Ok(WenTransferGuardProgramState::GuardV1(GuardV1::from_bytes( + GUARDV1_LEN => Ok(WenTransferGuardProgramState::GuardV1(GuardV1::from_bytes( data_bytes, )?)), _ => Err(yellowstone_vixen_core::ParseError::from( diff --git a/packages/renderers-vixen-parser/e2e/anchor/src/generated/instructions_parser.rs b/packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/instructions_parser.rs similarity index 68% rename from packages/renderers-vixen-parser/e2e/anchor/src/generated/instructions_parser.rs rename to packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/instructions_parser.rs index 25f9fb01..e1d97681 100644 --- a/packages/renderers-vixen-parser/e2e/anchor/src/generated/instructions_parser.rs +++ b/packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/instructions_parser.rs @@ -6,20 +6,20 @@ //! use borsh::BorshDeserialize; -use wen_transfer_guard_program_sdk::instructions::{ +use codama_renderers_rust_e2e_anchor::instructions::{ CreateGuard as CreateGuardIxAccounts, CreateGuardInstructionArgs as CreateGuardIxData, Execute as ExecuteIxAccounts, ExecuteInstructionArgs as ExecuteIxData, - Initialize as InitializeIxAccounts, InitializeInstructionArgs as InitializeIxData, - UpdateGuard as UpdateGuardIxAccounts, UpdateGuardInstructionArgs as UpdateGuardIxData, + Initialize as InitializeIxAccounts, UpdateGuard as UpdateGuardIxAccounts, + UpdateGuardInstructionArgs as UpdateGuardIxData, }; -use wen_transfer_guard_program_sdk::ID; +use codama_renderers_rust_e2e_anchor::ID; /// WenTransferGuard Instructions #[derive(Debug)] pub enum WenTransferGuardProgramIx { CreateGuard(CreateGuardIxAccounts, CreateGuardIxData), Execute(ExecuteIxAccounts, ExecuteIxData), - Initialize(InitializeIxAccounts, InitializeIxData), + Initialize(InitializeIxAccounts), UpdateGuard(UpdateGuardIxAccounts, UpdateGuardIxData), } @@ -70,17 +70,17 @@ impl InstructionParser { match ix_discriminator { [251, 254, 17, 198, 219, 218, 154, 99] => { check_min_accounts_req(accounts_len, 8)?; - let de_ix_data: CreateGuardIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = CreateGuardIxAccounts { - guard: ix.accounts[0], - mint: ix.accounts[1], - mint_token_account: ix.accounts[2], - guard_authority: ix.accounts[3], - payer: ix.accounts[4], - associated_token_program: ix.accounts[5], - token_program: ix.accounts[6], - system_program: ix.accounts[7], + guard: ix.accounts[0].0.into(), + mint: ix.accounts[1].0.into(), + mint_token_account: ix.accounts[2].0.into(), + guard_authority: ix.accounts[3].0.into(), + payer: ix.accounts[4].0.into(), + associated_token_program: ix.accounts[5].0.into(), + token_program: ix.accounts[6].0.into(), + system_program: ix.accounts[7].0.into(), }; + let de_ix_data: CreateGuardIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(WenTransferGuardProgramIx::CreateGuard( ix_accounts, de_ix_data, @@ -88,45 +88,41 @@ impl InstructionParser { } [105, 37, 101, 197, 75, 251, 102, 26] => { check_min_accounts_req(accounts_len, 7)?; - let de_ix_data: ExecuteIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = ExecuteIxAccounts { - source_account: ix.accounts[0], - mint: ix.accounts[1], - destination_account: ix.accounts[2], - owner_delegate: ix.accounts[3], - extra_metas_account: ix.accounts[4], - guard: ix.accounts[5], - instruction_sysvar_account: ix.accounts[6], + source_account: ix.accounts[0].0.into(), + mint: ix.accounts[1].0.into(), + destination_account: ix.accounts[2].0.into(), + owner_delegate: ix.accounts[3].0.into(), + extra_metas_account: ix.accounts[4].0.into(), + guard: ix.accounts[5].0.into(), + instruction_sysvar_account: ix.accounts[6].0.into(), }; + let de_ix_data: ExecuteIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(WenTransferGuardProgramIx::Execute(ix_accounts, de_ix_data)) } [43, 34, 13, 49, 167, 88, 235, 235] => { check_min_accounts_req(accounts_len, 6)?; - let de_ix_data: InitializeIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = InitializeIxAccounts { - extra_metas_account: ix.accounts[0], - guard: ix.accounts[1], - mint: ix.accounts[2], - transfer_hook_authority: ix.accounts[3], - system_program: ix.accounts[4], - payer: ix.accounts[5], + extra_metas_account: ix.accounts[0].0.into(), + guard: ix.accounts[1].0.into(), + mint: ix.accounts[2].0.into(), + transfer_hook_authority: ix.accounts[3].0.into(), + system_program: ix.accounts[4].0.into(), + payer: ix.accounts[5].0.into(), }; - Ok(WenTransferGuardProgramIx::Initialize( - ix_accounts, - de_ix_data, - )) + Ok(WenTransferGuardProgramIx::Initialize(ix_accounts)) } [51, 38, 175, 180, 25, 249, 39, 24] => { check_min_accounts_req(accounts_len, 6)?; - let de_ix_data: UpdateGuardIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = UpdateGuardIxAccounts { - guard: ix.accounts[0], - mint: ix.accounts[1], - token_account: ix.accounts[2], - guard_authority: ix.accounts[3], - token_program: ix.accounts[4], - system_program: ix.accounts[5], + guard: ix.accounts[0].0.into(), + mint: ix.accounts[1].0.into(), + token_account: ix.accounts[2].0.into(), + guard_authority: ix.accounts[3].0.into(), + token_program: ix.accounts[4].0.into(), + system_program: ix.accounts[5].0.into(), }; + let de_ix_data: UpdateGuardIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(WenTransferGuardProgramIx::UpdateGuard( ix_accounts, de_ix_data, diff --git a/packages/renderers-vixen-parser/e2e/anchor/src/generated/mod.rs b/packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/mod.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/anchor/src/generated/mod.rs rename to packages/renderers-vixen-parser/e2e/anchor_parser/src/generated/mod.rs diff --git a/packages/renderers-vixen-parser/e2e/anchor/src/lib.rs b/packages/renderers-vixen-parser/e2e/anchor_parser/src/lib.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/anchor/src/lib.rs rename to packages/renderers-vixen-parser/e2e/anchor_parser/src/lib.rs diff --git a/packages/renderers-vixen-parser/e2e/dummy/Cargo.lock b/packages/renderers-vixen-parser/e2e/dummy_parser/Cargo.lock similarity index 80% rename from packages/renderers-vixen-parser/e2e/dummy/Cargo.lock rename to packages/renderers-vixen-parser/e2e/dummy_parser/Cargo.lock index 7376e4b4..7b3c1909 100644 --- a/packages/renderers-vixen-parser/e2e/dummy/Cargo.lock +++ b/packages/renderers-vixen-parser/e2e/dummy_parser/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -17,6 +17,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.11" @@ -44,6 +55,123 @@ version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -178,6 +306,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -198,6 +332,18 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] [[package]] name = "blake3" @@ -231,6 +377,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + [[package]] name = "borsh" version = "0.10.4" @@ -251,14 +407,27 @@ dependencies = [ "cfg_aliases", ] +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "borsh-derive" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", + "borsh-derive-internal 0.10.4", + "borsh-schema-derive-internal 0.10.4", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -277,6 +446,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-derive-internal" version = "0.10.4" @@ -288,6 +468,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-schema-derive-internal" version = "0.10.4" @@ -299,6 +490,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bs58" version = "0.5.1" @@ -329,6 +526,9 @@ name = "bytemuck" version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +dependencies = [ + "bytemuck_derive", +] [[package]] name = "bytemuck_derive" @@ -359,6 +559,8 @@ version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -374,12 +576,26 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "codama-renderers-rust-e2e-dummy" +version = "0.0.0" +dependencies = [ + "borsh 1.5.3", + "borsh-derive 1.5.3", + "kaigan", + "num-derive 0.3.3", + "num-traits", + "solana-program 1.18.26", + "thiserror", +] + [[package]] name = "codama-renderers-vixen-parser-e2e-dummy" version = "0.0.0" dependencies = [ "borsh 1.5.3", - "solana-program", + "codama-renderers-rust-e2e-dummy", + "solana-program 2.1.6", "yellowstone-vixen-core", ] @@ -418,6 +634,31 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.2" @@ -434,6 +675,30 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "serde", + "subtle", + "zeroize", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -462,6 +727,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.9.0" @@ -594,6 +870,7 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", ] @@ -605,8 +882,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -647,6 +926,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.8", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -659,7 +947,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash", + "ahash 0.8.11", ] [[package]] @@ -674,6 +962,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + [[package]] name = "http" version = "1.2.0" @@ -773,6 +1082,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -793,6 +1118,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -808,6 +1142,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.76" @@ -818,6 +1161,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kaigan" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6dd100976df9dd59d0c3fecf6f9ad3f161a087374d1b2a77ebb4ad8920f11bb" +dependencies = [ + "borsh 0.10.4", +] + [[package]] name = "keccak" version = "0.1.5" @@ -848,12 +1200,14 @@ dependencies = [ "arrayref", "base64 0.12.3", "digest 0.9.0", + "hmac-drbg", "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", "rand 0.7.3", "serde", "sha2 0.9.9", + "typenum", ] [[package]] @@ -885,6 +1239,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint", + "thiserror", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -919,6 +1285,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.9.1" @@ -970,6 +1345,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num-derive" version = "0.4.2" @@ -1043,6 +1429,21 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1154,7 +1555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" dependencies = [ "heck", - "itertools", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1174,7 +1575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.90", @@ -1278,6 +1679,35 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.8" @@ -1322,6 +1752,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1350,6 +1786,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + [[package]] name = "scopeguard" version = "1.2.0" @@ -1391,6 +1833,18 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1431,6 +1885,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -1507,7 +1971,7 @@ checksum = "b26a68f89972fddb370ba33a49340bd3419da529893d9ee851211588aee811fa" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1548,7 +2012,7 @@ checksum = "c60dde3613fcd1af91c2033e67ffe8c8d2bcd58085c53c842fa7903fa839ad38" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1563,6 +2027,43 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "solana-frozen-abi" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ab2c30c15311b511c0d1151e4ab6bc9a3e080a37e7c6e7c2d96f5784cf9434" +dependencies = [ + "block-buffer 0.10.4", + "bs58 0.4.0", + "bv", + "either", + "generic-array", + "im", + "lazy_static", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_bytes", + "serde_derive", + "sha2 0.10.8", + "solana-frozen-abi-macro", + "subtle", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142f779c3633ac83c84d04ff06c70e1f558c876f13358bed77ba629c7417932" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.90", +] + [[package]] name = "solana-hash" version = "2.1.6" @@ -1570,7 +2071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a86aabbd7ebf807689a0355f053d6dc31d2131c2d83613011a374a18cc5d61b7" dependencies = [ "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", "js-sys", @@ -1607,7 +2108,7 @@ checksum = "bd5647af0980c796c942e33f1f7dbffca29b7747630b720e6975abb1d7c531f6" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1626,6 +2127,61 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa3c5006bbea99b810ad8fc6ae168fc83891b607a13a9aa6be39db71a700f87" +[[package]] +name = "solana-program" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10f4588cefd716b24a1a40dd32c278e43a560ab8ce4de6b5805c9d113afdfa1" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "base64 0.21.7", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.4", + "borsh 0.9.3", + "borsh 1.5.3", + "bs58 0.4.0", + "bv", + "bytemuck", + "cc", + "console_error_panic_hook", + "console_log", + "curve25519-dalek 3.2.1", + "getrandom 0.2.15", + "itertools 0.10.5", + "js-sys", + "lazy_static", + "libc", + "libsecp256k1", + "light-poseidon", + "log", + "memoffset", + "num-bigint", + "num-derive 0.4.2", + "num-traits", + "parking_lot", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.8", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro 1.18.26", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "solana-program" version = "2.1.6" @@ -1638,13 +2194,13 @@ dependencies = [ "blake3", "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bv", "bytemuck", "bytemuck_derive", "console_error_panic_hook", "console_log", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1652,7 +2208,7 @@ dependencies = [ "log", "memoffset", "num-bigint", - "num-derive", + "num-derive 0.4.2", "num-traits", "parking_lot", "rand 0.8.5", @@ -1684,7 +2240,7 @@ dependencies = [ "solana-pubkey", "solana-rent", "solana-sanitize", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-secp256k1-recover", "solana-serde-varint", "solana-serialize-utils", @@ -1760,10 +2316,10 @@ checksum = "a954fba3af498201179981818b0ed61f95c32b4a3db5ea9cc042c971c84cdeae" dependencies = [ "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1786,7 +2342,7 @@ checksum = "4ebcc59bff8b3c773214545d038b718a3e2e63c920b8172f85725463029f7f00" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1796,13 +2352,26 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05ecd7ec442abf0561cbf06984484d6368e71a4882213bfa68b658b0f8d6a0e" +[[package]] +name = "solana-sdk-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b75d0f193a27719257af19144fdaebec0415d1c9e9226ae4bd29b791be5e9bd" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.90", +] + [[package]] name = "solana-sdk-macro" version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85df4723291cfec8ffe9dadc59d565afcae12ea9a6460b7b28c4da21c2c4a887" dependencies = [ - "bs58", + "bs58 0.5.1", "proc-macro2", "quote", "syn 2.0.90", @@ -1979,6 +2548,25 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac", + "once_cell", + "pbkdf2", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2210,6 +2798,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "version_check" version = "0.9.5" @@ -2411,7 +3008,7 @@ name = "yellowstone-vixen-core" version = "0.0.0" source = "git+https://github.com/rpcpool/yellowstone-vixen?branch=main#4b61e848d19f117125a36a5bd38968da1d5ad94d" dependencies = [ - "bs58", + "bs58 0.5.1", "thiserror", "yellowstone-grpc-proto", ] @@ -2439,6 +3036,20 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] diff --git a/packages/renderers-vixen-parser/e2e/dummy/Cargo.toml b/packages/renderers-vixen-parser/e2e/dummy_parser/Cargo.toml similarity index 75% rename from packages/renderers-vixen-parser/e2e/dummy/Cargo.toml rename to packages/renderers-vixen-parser/e2e/dummy_parser/Cargo.toml index f661ff52..890454b1 100644 --- a/packages/renderers-vixen-parser/e2e/dummy/Cargo.toml +++ b/packages/renderers-vixen-parser/e2e/dummy_parser/Cargo.toml @@ -6,5 +6,6 @@ edition = "2021" [dependencies] yellowstone-vixen-core = { git = "https://github.com/rpcpool/yellowstone-vixen", branch = "main" } +codama-renderers-rust-e2e-dummy = { path = "../../../renderers-rust/e2e/dummy" } solana-program = "^2.1.6" borsh = "^1.5.3" diff --git a/packages/renderers-vixen-parser/e2e/dummy/idl.json b/packages/renderers-vixen-parser/e2e/dummy_parser/idl.json similarity index 100% rename from packages/renderers-vixen-parser/e2e/dummy/idl.json rename to packages/renderers-vixen-parser/e2e/dummy_parser/idl.json diff --git a/packages/renderers-vixen-parser/e2e/dummy/src/generated/instructions_parser.rs b/packages/renderers-vixen-parser/e2e/dummy_parser/src/generated/instructions_parser.rs similarity index 80% rename from packages/renderers-vixen-parser/e2e/dummy/src/generated/instructions_parser.rs rename to packages/renderers-vixen-parser/e2e/dummy_parser/src/generated/instructions_parser.rs index 7a6bf451..432f4ee7 100644 --- a/packages/renderers-vixen-parser/e2e/dummy/src/generated/instructions_parser.rs +++ b/packages/renderers-vixen-parser/e2e/dummy_parser/src/generated/instructions_parser.rs @@ -6,21 +6,21 @@ //! use borsh::BorshDeserialize; -use dummy_program_sdk::instructions::{ +use codama_renderers_rust_e2e_dummy::instructions::{ Instruction1 as Instruction1IxAccounts, Instruction2 as Instruction2IxAccounts, - Instruction3 as Instruction3IxAccounts, Instruction3InstructionArgs as Instruction3IxData, - Instruction4 as Instruction4IxAccounts, Instruction4InstructionArgs as Instruction4IxData, - Instruction5 as Instruction5IxAccounts, Instruction5InstructionArgs as Instruction5IxData, - Instruction6 as Instruction6IxAccounts, Instruction7 as Instruction7IxAccounts, + Instruction3 as Instruction3IxAccounts, Instruction4 as Instruction4IxAccounts, + Instruction4InstructionArgs as Instruction4IxData, Instruction5 as Instruction5IxAccounts, + Instruction5InstructionArgs as Instruction5IxData, Instruction6 as Instruction6IxAccounts, + Instruction7 as Instruction7IxAccounts, }; -use dummy_program_sdk::ID; +use codama_renderers_rust_e2e_dummy::ID; /// Dummy Instructions #[derive(Debug)] pub enum DummyProgramIx { Instruction1(Instruction1IxAccounts), Instruction2(Instruction2IxAccounts), - Instruction3(Instruction3IxAccounts, Instruction3IxData), + Instruction3(Instruction3IxAccounts), Instruction4(Instruction4IxAccounts, Instruction4IxData), Instruction5(Instruction5IxAccounts, Instruction5IxData), Instruction6(Instruction6IxAccounts), @@ -74,9 +74,8 @@ impl InstructionParser { match ix_discriminator { [42] => { check_min_accounts_req(accounts_len, 0)?; - let de_ix_data: Instruction3IxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = Instruction3IxAccounts {}; - Ok(DummyProgramIx::Instruction3(ix_accounts, de_ix_data)) + Ok(DummyProgramIx::Instruction3(ix_accounts)) } _ => Err(yellowstone_vixen_core::ParseError::from( "Invalid Instruction discriminator".to_owned(), diff --git a/packages/renderers-vixen-parser/e2e/dummy/src/generated/mod.rs b/packages/renderers-vixen-parser/e2e/dummy_parser/src/generated/mod.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/dummy/src/generated/mod.rs rename to packages/renderers-vixen-parser/e2e/dummy_parser/src/generated/mod.rs diff --git a/packages/renderers-vixen-parser/e2e/dummy/src/lib.rs b/packages/renderers-vixen-parser/e2e/dummy_parser/src/lib.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/dummy/src/lib.rs rename to packages/renderers-vixen-parser/e2e/dummy_parser/src/lib.rs diff --git a/packages/renderers-vixen-parser/e2e/generate-anchor.cjs b/packages/renderers-vixen-parser/e2e/generate-anchor.cjs index 2c725d2f..35f9eac7 100644 --- a/packages/renderers-vixen-parser/e2e/generate-anchor.cjs +++ b/packages/renderers-vixen-parser/e2e/generate-anchor.cjs @@ -3,28 +3,36 @@ const path = require('node:path'); const process = require('node:process'); -const { rootNode } = require('@codama/nodes'); const { rootNodeFromAnchor } = require('@codama/nodes-from-anchor'); const { readJson } = require('@codama/renderers-core'); const { visit } = require('@codama/visitors-core'); const { renderVisitor } = require('../dist/index.node.cjs'); +function transformHyphensToUnderscores(input) { + return input.replace(/-/g, '_'); +} + async function main() { const project = process.argv.slice(2)[0] ?? undefined; + const sdkName = process.argv.slice(3)[0] ? transformHyphensToUnderscores(process.argv.slice(3)[0]) : undefined; if (project === undefined) { throw new Error('Project name is required.'); } - await generateProject(project); + if (sdkName === undefined) { + throw new Error('SDK name is required.'); + } + await generateProject(project, sdkName); } -async function generateProject(project) { +async function generateProject(project, sdkName) { const idl = readJson(path.join(__dirname, project, 'idl.json')); const node = rootNodeFromAnchor(idl); visit( node, renderVisitor(path.join(__dirname, project, 'src', 'generated'), { + sdkName: sdkName, crateFolder: path.join(__dirname, project), formatCode: true, }), diff --git a/packages/renderers-vixen-parser/e2e/generate.cjs b/packages/renderers-vixen-parser/e2e/generate.cjs index f30672c7..1466efc1 100644 --- a/packages/renderers-vixen-parser/e2e/generate.cjs +++ b/packages/renderers-vixen-parser/e2e/generate.cjs @@ -9,20 +9,32 @@ const { visit } = require('@codama/visitors-core'); const { renderVisitor } = require('../dist/index.node.cjs'); +function transformHyphensToUnderscores(input) { + return input.replace(/-/g, '_'); +} + async function main() { const project = process.argv.slice(2)[0] ?? undefined; + const sdkName = process.argv.slice(3)[0] ? transformHyphensToUnderscores(process.argv.slice(3)[0]) : undefined; + if (project === undefined) { throw new Error('Project name is required.'); } - await generateProject(project); + + if (sdkName === undefined) { + throw new Error('SDK name is required.'); + } + + await generateProject(project, sdkName); } -async function generateProject(project) { +async function generateProject(project, sdkName) { const idl = readJson(path.join(__dirname, project, 'idl.json')); const node = rootNode(idl.program); visit( node, renderVisitor(path.join(__dirname, project, 'src', 'generated'), { + sdkName: sdkName, crateFolder: path.join(__dirname, project), formatCode: true, }), diff --git a/packages/renderers-vixen-parser/e2e/memo/Cargo.lock b/packages/renderers-vixen-parser/e2e/memo_parser/Cargo.lock similarity index 80% rename from packages/renderers-vixen-parser/e2e/memo/Cargo.lock rename to packages/renderers-vixen-parser/e2e/memo_parser/Cargo.lock index 84c29bbf..ed6d8cb3 100644 --- a/packages/renderers-vixen-parser/e2e/memo/Cargo.lock +++ b/packages/renderers-vixen-parser/e2e/memo_parser/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -17,6 +17,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.11" @@ -44,6 +55,123 @@ version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -178,6 +306,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -198,6 +332,18 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] [[package]] name = "blake3" @@ -231,6 +377,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + [[package]] name = "borsh" version = "0.10.4" @@ -251,14 +407,27 @@ dependencies = [ "cfg_aliases", ] +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "borsh-derive" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", + "borsh-derive-internal 0.10.4", + "borsh-schema-derive-internal 0.10.4", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -277,6 +446,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-derive-internal" version = "0.10.4" @@ -288,6 +468,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-schema-derive-internal" version = "0.10.4" @@ -299,6 +490,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bs58" version = "0.5.1" @@ -329,6 +526,9 @@ name = "bytemuck" version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +dependencies = [ + "bytemuck_derive", +] [[package]] name = "bytemuck_derive" @@ -359,6 +559,8 @@ version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -374,12 +576,26 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "codama-renderers-rust-e2e-memo" +version = "0.0.0" +dependencies = [ + "borsh 1.5.3", + "borsh-derive 1.5.3", + "kaigan", + "num-derive 0.3.3", + "num-traits", + "solana-program 1.18.26", + "thiserror", +] + [[package]] name = "codama-renderers-vixen-parser-e2e-memo" version = "0.0.0" dependencies = [ "borsh 1.5.3", - "solana-program", + "codama-renderers-rust-e2e-memo", + "solana-program 2.1.6", "yellowstone-vixen-core", ] @@ -418,6 +634,31 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.2" @@ -434,6 +675,30 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "serde", + "subtle", + "zeroize", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -462,6 +727,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.9.0" @@ -594,6 +870,7 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", ] @@ -605,8 +882,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -647,6 +926,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.8", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -659,7 +947,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash", + "ahash 0.8.11", ] [[package]] @@ -674,6 +962,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + [[package]] name = "http" version = "1.2.0" @@ -773,6 +1082,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -793,6 +1118,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -808,6 +1142,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.76" @@ -818,6 +1161,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kaigan" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6dd100976df9dd59d0c3fecf6f9ad3f161a087374d1b2a77ebb4ad8920f11bb" +dependencies = [ + "borsh 0.10.4", +] + [[package]] name = "keccak" version = "0.1.5" @@ -848,12 +1200,14 @@ dependencies = [ "arrayref", "base64 0.12.3", "digest 0.9.0", + "hmac-drbg", "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", "rand 0.7.3", "serde", "sha2 0.9.9", + "typenum", ] [[package]] @@ -885,6 +1239,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint", + "thiserror", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -919,6 +1285,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.9.1" @@ -970,6 +1345,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num-derive" version = "0.4.2" @@ -1043,6 +1429,21 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1154,7 +1555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" dependencies = [ "heck", - "itertools", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1174,7 +1575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.90", @@ -1278,6 +1679,35 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.8" @@ -1322,6 +1752,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1350,6 +1786,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + [[package]] name = "scopeguard" version = "1.2.0" @@ -1391,6 +1833,18 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1431,6 +1885,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -1507,7 +1971,7 @@ checksum = "b26a68f89972fddb370ba33a49340bd3419da529893d9ee851211588aee811fa" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1548,7 +2012,7 @@ checksum = "c60dde3613fcd1af91c2033e67ffe8c8d2bcd58085c53c842fa7903fa839ad38" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1563,6 +2027,43 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "solana-frozen-abi" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ab2c30c15311b511c0d1151e4ab6bc9a3e080a37e7c6e7c2d96f5784cf9434" +dependencies = [ + "block-buffer 0.10.4", + "bs58 0.4.0", + "bv", + "either", + "generic-array", + "im", + "lazy_static", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_bytes", + "serde_derive", + "sha2 0.10.8", + "solana-frozen-abi-macro", + "subtle", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142f779c3633ac83c84d04ff06c70e1f558c876f13358bed77ba629c7417932" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.90", +] + [[package]] name = "solana-hash" version = "2.1.6" @@ -1570,7 +2071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a86aabbd7ebf807689a0355f053d6dc31d2131c2d83613011a374a18cc5d61b7" dependencies = [ "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", "js-sys", @@ -1607,7 +2108,7 @@ checksum = "bd5647af0980c796c942e33f1f7dbffca29b7747630b720e6975abb1d7c531f6" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1626,6 +2127,61 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa3c5006bbea99b810ad8fc6ae168fc83891b607a13a9aa6be39db71a700f87" +[[package]] +name = "solana-program" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10f4588cefd716b24a1a40dd32c278e43a560ab8ce4de6b5805c9d113afdfa1" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "base64 0.21.7", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.4", + "borsh 0.9.3", + "borsh 1.5.3", + "bs58 0.4.0", + "bv", + "bytemuck", + "cc", + "console_error_panic_hook", + "console_log", + "curve25519-dalek 3.2.1", + "getrandom 0.2.15", + "itertools 0.10.5", + "js-sys", + "lazy_static", + "libc", + "libsecp256k1", + "light-poseidon", + "log", + "memoffset", + "num-bigint", + "num-derive 0.4.2", + "num-traits", + "parking_lot", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.8", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro 1.18.26", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "solana-program" version = "2.1.6" @@ -1638,13 +2194,13 @@ dependencies = [ "blake3", "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bv", "bytemuck", "bytemuck_derive", "console_error_panic_hook", "console_log", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1652,7 +2208,7 @@ dependencies = [ "log", "memoffset", "num-bigint", - "num-derive", + "num-derive 0.4.2", "num-traits", "parking_lot", "rand 0.8.5", @@ -1684,7 +2240,7 @@ dependencies = [ "solana-pubkey", "solana-rent", "solana-sanitize", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-secp256k1-recover", "solana-serde-varint", "solana-serialize-utils", @@ -1760,10 +2316,10 @@ checksum = "a954fba3af498201179981818b0ed61f95c32b4a3db5ea9cc042c971c84cdeae" dependencies = [ "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1786,7 +2342,7 @@ checksum = "4ebcc59bff8b3c773214545d038b718a3e2e63c920b8172f85725463029f7f00" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1796,13 +2352,26 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05ecd7ec442abf0561cbf06984484d6368e71a4882213bfa68b658b0f8d6a0e" +[[package]] +name = "solana-sdk-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b75d0f193a27719257af19144fdaebec0415d1c9e9226ae4bd29b791be5e9bd" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.90", +] + [[package]] name = "solana-sdk-macro" version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85df4723291cfec8ffe9dadc59d565afcae12ea9a6460b7b28c4da21c2c4a887" dependencies = [ - "bs58", + "bs58 0.5.1", "proc-macro2", "quote", "syn 2.0.90", @@ -1979,6 +2548,25 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac", + "once_cell", + "pbkdf2", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2210,6 +2798,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "version_check" version = "0.9.5" @@ -2411,7 +3008,7 @@ name = "yellowstone-vixen-core" version = "0.0.0" source = "git+https://github.com/rpcpool/yellowstone-vixen?branch=main#4b61e848d19f117125a36a5bd38968da1d5ad94d" dependencies = [ - "bs58", + "bs58 0.5.1", "thiserror", "yellowstone-grpc-proto", ] @@ -2439,6 +3036,20 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] diff --git a/packages/renderers-vixen-parser/e2e/memo/Cargo.toml b/packages/renderers-vixen-parser/e2e/memo_parser/Cargo.toml similarity index 76% rename from packages/renderers-vixen-parser/e2e/memo/Cargo.toml rename to packages/renderers-vixen-parser/e2e/memo_parser/Cargo.toml index 37093149..3cb28cb2 100644 --- a/packages/renderers-vixen-parser/e2e/memo/Cargo.toml +++ b/packages/renderers-vixen-parser/e2e/memo_parser/Cargo.toml @@ -6,5 +6,6 @@ edition = "2021" [dependencies] yellowstone-vixen-core = { git = "https://github.com/rpcpool/yellowstone-vixen", branch = "main" } +codama-renderers-rust-e2e-memo = { path = "../../../renderers-rust/e2e/memo" } solana-program = "^2.1.6" borsh = "^1.5.3" diff --git a/packages/renderers-vixen-parser/e2e/memo/idl.json b/packages/renderers-vixen-parser/e2e/memo_parser/idl.json similarity index 100% rename from packages/renderers-vixen-parser/e2e/memo/idl.json rename to packages/renderers-vixen-parser/e2e/memo_parser/idl.json diff --git a/packages/renderers-vixen-parser/e2e/memo/src/generated/instructions_parser.rs b/packages/renderers-vixen-parser/e2e/memo_parser/src/generated/instructions_parser.rs similarity index 96% rename from packages/renderers-vixen-parser/e2e/memo/src/generated/instructions_parser.rs rename to packages/renderers-vixen-parser/e2e/memo_parser/src/generated/instructions_parser.rs index 19a20734..a7425768 100644 --- a/packages/renderers-vixen-parser/e2e/memo/src/generated/instructions_parser.rs +++ b/packages/renderers-vixen-parser/e2e/memo_parser/src/generated/instructions_parser.rs @@ -6,10 +6,10 @@ //! use borsh::BorshDeserialize; -use memo_program_sdk::instructions::{ +use codama_renderers_rust_e2e_memo::instructions::{ AddMemo as AddMemoIxAccounts, AddMemoInstructionArgs as AddMemoIxData, }; -use memo_program_sdk::ID; +use codama_renderers_rust_e2e_memo::ID; /// Memo Instructions #[derive(Debug)] diff --git a/packages/renderers-vixen-parser/e2e/memo/src/generated/mod.rs b/packages/renderers-vixen-parser/e2e/memo_parser/src/generated/mod.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/memo/src/generated/mod.rs rename to packages/renderers-vixen-parser/e2e/memo_parser/src/generated/mod.rs diff --git a/packages/renderers-vixen-parser/e2e/memo/src/lib.rs b/packages/renderers-vixen-parser/e2e/memo_parser/src/lib.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/memo/src/lib.rs rename to packages/renderers-vixen-parser/e2e/memo_parser/src/lib.rs diff --git a/packages/renderers-vixen-parser/e2e/anchor/Cargo.lock b/packages/renderers-vixen-parser/e2e/system_parser/Cargo.lock similarity index 81% rename from packages/renderers-vixen-parser/e2e/anchor/Cargo.lock rename to packages/renderers-vixen-parser/e2e/system_parser/Cargo.lock index b54bf0ee..bf4aedae 100644 --- a/packages/renderers-vixen-parser/e2e/anchor/Cargo.lock +++ b/packages/renderers-vixen-parser/e2e/system_parser/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -17,6 +17,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.11" @@ -44,6 +55,123 @@ version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -178,6 +306,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -198,6 +332,18 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] [[package]] name = "blake3" @@ -231,6 +377,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "borsh" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +dependencies = [ + "borsh-derive 0.9.3", + "hashbrown 0.11.2", +] + [[package]] name = "borsh" version = "0.10.4" @@ -238,7 +394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115e54d64eb62cdebad391c19efc9dce4981c690c85a33a12199d99bb9546fee" dependencies = [ "borsh-derive 0.10.4", - "hashbrown 0.13.2", + "hashbrown 0.12.3", ] [[package]] @@ -251,14 +407,27 @@ dependencies = [ "cfg_aliases", ] +[[package]] +name = "borsh-derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +dependencies = [ + "borsh-derive-internal 0.9.3", + "borsh-schema-derive-internal 0.9.3", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "borsh-derive" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", + "borsh-derive-internal 0.10.4", + "borsh-schema-derive-internal 0.10.4", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", @@ -277,6 +446,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "borsh-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-derive-internal" version = "0.10.4" @@ -288,6 +468,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "borsh-schema-derive-internal" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "borsh-schema-derive-internal" version = "0.10.4" @@ -299,6 +490,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bs58" version = "0.5.1" @@ -329,6 +526,9 @@ name = "bytemuck" version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +dependencies = [ + "bytemuck_derive", +] [[package]] name = "bytemuck_derive" @@ -359,6 +559,8 @@ version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -375,11 +577,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] -name = "codama-renderers-vixen-parser-e2e-anchor" +name = "codama-renderers-rust-e2e-system" +version = "0.0.0" +dependencies = [ + "borsh 1.5.3", + "borsh-derive 1.5.3", + "num-derive 0.3.3", + "num-traits", + "solana-program 1.18.26", + "thiserror", +] + +[[package]] +name = "codama-renderers-vixen-parser-e2e-system" version = "0.0.0" dependencies = [ "borsh 1.5.3", - "solana-program", + "borsh-derive 1.5.3", + "codama-renderers-rust-e2e-system", + "solana-program 2.1.6", "yellowstone-vixen-core", ] @@ -418,6 +634,31 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.2" @@ -434,6 +675,30 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "serde", + "subtle", + "zeroize", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -462,6 +727,17 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.9.0" @@ -594,6 +870,7 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", ] @@ -605,8 +882,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -647,11 +926,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.8", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] [[package]] name = "hashbrown" @@ -659,7 +950,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash", + "ahash 0.8.11", ] [[package]] @@ -674,6 +965,27 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac", +] + [[package]] name = "http" version = "1.2.0" @@ -773,6 +1085,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "rayon", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -793,6 +1121,15 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -808,6 +1145,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.76" @@ -848,12 +1194,14 @@ dependencies = [ "arrayref", "base64 0.12.3", "digest 0.9.0", + "hmac-drbg", "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", "rand 0.7.3", "serde", "sha2 0.9.9", + "typenum", ] [[package]] @@ -885,6 +1233,18 @@ dependencies = [ "libsecp256k1-core", ] +[[package]] +name = "light-poseidon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" +dependencies = [ + "ark-bn254", + "ark-ff", + "num-bigint", + "thiserror", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -919,6 +1279,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.9.1" @@ -970,6 +1339,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num-derive" version = "0.4.2" @@ -1043,6 +1423,21 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" +dependencies = [ + "crypto-mac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1154,7 +1549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" dependencies = [ "heck", - "itertools", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1174,7 +1569,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.90", @@ -1278,6 +1673,35 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redox_syscall" version = "0.5.8" @@ -1322,6 +1746,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1350,6 +1780,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + [[package]] name = "scopeguard" version = "1.2.0" @@ -1391,6 +1827,18 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_json" +version = "1.0.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1431,6 +1879,16 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -1507,7 +1965,7 @@ checksum = "b26a68f89972fddb370ba33a49340bd3419da529893d9ee851211588aee811fa" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1548,7 +2006,7 @@ checksum = "c60dde3613fcd1af91c2033e67ffe8c8d2bcd58085c53c842fa7903fa839ad38" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1563,6 +2021,43 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "solana-frozen-abi" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ab2c30c15311b511c0d1151e4ab6bc9a3e080a37e7c6e7c2d96f5784cf9434" +dependencies = [ + "block-buffer 0.10.4", + "bs58 0.4.0", + "bv", + "either", + "generic-array", + "im", + "lazy_static", + "log", + "memmap2", + "rustc_version", + "serde", + "serde_bytes", + "serde_derive", + "sha2 0.10.8", + "solana-frozen-abi-macro", + "subtle", + "thiserror", +] + +[[package]] +name = "solana-frozen-abi-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142f779c3633ac83c84d04ff06c70e1f558c876f13358bed77ba629c7417932" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.90", +] + [[package]] name = "solana-hash" version = "2.1.6" @@ -1570,7 +2065,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a86aabbd7ebf807689a0355f053d6dc31d2131c2d83613011a374a18cc5d61b7" dependencies = [ "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", "js-sys", @@ -1607,7 +2102,7 @@ checksum = "bd5647af0980c796c942e33f1f7dbffca29b7747630b720e6975abb1d7c531f6" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1626,6 +2121,61 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0aa3c5006bbea99b810ad8fc6ae168fc83891b607a13a9aa6be39db71a700f87" +[[package]] +name = "solana-program" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10f4588cefd716b24a1a40dd32c278e43a560ab8ce4de6b5805c9d113afdfa1" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "base64 0.21.7", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.4", + "borsh 0.9.3", + "borsh 1.5.3", + "bs58 0.4.0", + "bv", + "bytemuck", + "cc", + "console_error_panic_hook", + "console_log", + "curve25519-dalek 3.2.1", + "getrandom 0.2.15", + "itertools 0.10.5", + "js-sys", + "lazy_static", + "libc", + "libsecp256k1", + "light-poseidon", + "log", + "memoffset", + "num-bigint", + "num-derive 0.4.2", + "num-traits", + "parking_lot", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "sha2 0.10.8", + "sha3", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-sdk-macro 1.18.26", + "thiserror", + "tiny-bip39", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "solana-program" version = "2.1.6" @@ -1638,13 +2188,13 @@ dependencies = [ "blake3", "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bv", "bytemuck", "bytemuck_derive", "console_error_panic_hook", "console_log", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1652,7 +2202,7 @@ dependencies = [ "log", "memoffset", "num-bigint", - "num-derive", + "num-derive 0.4.2", "num-traits", "parking_lot", "rand 0.8.5", @@ -1684,7 +2234,7 @@ dependencies = [ "solana-pubkey", "solana-rent", "solana-sanitize", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-secp256k1-recover", "solana-serde-varint", "solana-serialize-utils", @@ -1760,10 +2310,10 @@ checksum = "a954fba3af498201179981818b0ed61f95c32b4a3db5ea9cc042c971c84cdeae" dependencies = [ "borsh 0.10.4", "borsh 1.5.3", - "bs58", + "bs58 0.5.1", "bytemuck", "bytemuck_derive", - "curve25519-dalek", + "curve25519-dalek 4.1.3", "five8_const", "getrandom 0.2.15", "js-sys", @@ -1786,7 +2336,7 @@ checksum = "4ebcc59bff8b3c773214545d038b718a3e2e63c920b8172f85725463029f7f00" dependencies = [ "serde", "serde_derive", - "solana-sdk-macro", + "solana-sdk-macro 2.1.6", "solana-sysvar-id", ] @@ -1796,13 +2346,26 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05ecd7ec442abf0561cbf06984484d6368e71a4882213bfa68b658b0f8d6a0e" +[[package]] +name = "solana-sdk-macro" +version = "1.18.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b75d0f193a27719257af19144fdaebec0415d1c9e9226ae4bd29b791be5e9bd" +dependencies = [ + "bs58 0.4.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.90", +] + [[package]] name = "solana-sdk-macro" version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85df4723291cfec8ffe9dadc59d565afcae12ea9a6460b7b28c4da21c2c4a887" dependencies = [ - "bs58", + "bs58 0.5.1", "proc-macro2", "quote", "syn 2.0.90", @@ -1979,6 +2542,25 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "tiny-bip39" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +dependencies = [ + "anyhow", + "hmac", + "once_cell", + "pbkdf2", + "rand 0.7.3", + "rustc-hash", + "sha2 0.9.9", + "thiserror", + "unicode-normalization", + "wasm-bindgen", + "zeroize", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -2210,6 +2792,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "version_check" version = "0.9.5" @@ -2411,7 +3002,7 @@ name = "yellowstone-vixen-core" version = "0.0.0" source = "git+https://github.com/rpcpool/yellowstone-vixen?branch=main#4b61e848d19f117125a36a5bd38968da1d5ad94d" dependencies = [ - "bs58", + "bs58 0.5.1", "thiserror", "yellowstone-grpc-proto", ] @@ -2439,6 +3030,20 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] diff --git a/packages/renderers-vixen-parser/e2e/system/Cargo.toml b/packages/renderers-vixen-parser/e2e/system_parser/Cargo.toml similarity index 70% rename from packages/renderers-vixen-parser/e2e/system/Cargo.toml rename to packages/renderers-vixen-parser/e2e/system_parser/Cargo.toml index 1f8b404e..eaf81f9e 100644 --- a/packages/renderers-vixen-parser/e2e/system/Cargo.toml +++ b/packages/renderers-vixen-parser/e2e/system_parser/Cargo.toml @@ -6,5 +6,7 @@ edition = "2021" [dependencies] yellowstone-vixen-core = { git = "https://github.com/rpcpool/yellowstone-vixen", branch = "main" } +codama-renderers-rust-e2e-system = { path = "../../../renderers-rust/e2e/system" } solana-program = "^2.1.6" borsh = "^1.5.3" +borsh-derive = "^1.5.3" diff --git a/packages/renderers-vixen-parser/e2e/system/idl.json b/packages/renderers-vixen-parser/e2e/system_parser/idl.json similarity index 100% rename from packages/renderers-vixen-parser/e2e/system/idl.json rename to packages/renderers-vixen-parser/e2e/system_parser/idl.json diff --git a/packages/renderers-vixen-parser/e2e/system/src/generated/accounts_parser.rs b/packages/renderers-vixen-parser/e2e/system_parser/src/generated/accounts_parser.rs similarity index 94% rename from packages/renderers-vixen-parser/e2e/system/src/generated/accounts_parser.rs rename to packages/renderers-vixen-parser/e2e/system_parser/src/generated/accounts_parser.rs index d327f19e..0a0105ca 100644 --- a/packages/renderers-vixen-parser/e2e/system/src/generated/accounts_parser.rs +++ b/packages/renderers-vixen-parser/e2e/system_parser/src/generated/accounts_parser.rs @@ -5,8 +5,8 @@ //! //! -use system_program_sdk::accounts::nonce::Nonce; -use system_program_sdk::ID; +use codama_renderers_rust_e2e_system::accounts::Nonce; +use codama_renderers_rust_e2e_system::ID; /// System Program State #[allow(clippy::large_enum_variant)] diff --git a/packages/renderers-vixen-parser/e2e/system/src/generated/instructions_parser.rs b/packages/renderers-vixen-parser/e2e/system_parser/src/generated/instructions_parser.rs similarity index 77% rename from packages/renderers-vixen-parser/e2e/system/src/generated/instructions_parser.rs rename to packages/renderers-vixen-parser/e2e/system_parser/src/generated/instructions_parser.rs index bbb7d79a..ae69a0da 100644 --- a/packages/renderers-vixen-parser/e2e/system/src/generated/instructions_parser.rs +++ b/packages/renderers-vixen-parser/e2e/system_parser/src/generated/instructions_parser.rs @@ -6,11 +6,9 @@ //! use borsh::BorshDeserialize; -use system_program_sdk::instructions::{ - AdvanceNonceAccount as AdvanceNonceAccountIxAccounts, - AdvanceNonceAccountInstructionArgs as AdvanceNonceAccountIxData, - Allocate as AllocateIxAccounts, AllocateInstructionArgs as AllocateIxData, - AllocateWithSeed as AllocateWithSeedIxAccounts, +use codama_renderers_rust_e2e_system::instructions::{ + AdvanceNonceAccount as AdvanceNonceAccountIxAccounts, Allocate as AllocateIxAccounts, + AllocateInstructionArgs as AllocateIxData, AllocateWithSeed as AllocateWithSeedIxAccounts, AllocateWithSeedInstructionArgs as AllocateWithSeedIxData, Assign as AssignIxAccounts, AssignInstructionArgs as AssignIxData, AssignWithSeed as AssignWithSeedIxAccounts, AssignWithSeedInstructionArgs as AssignWithSeedIxData, @@ -25,11 +23,10 @@ use system_program_sdk::instructions::{ TransferSolWithSeed as TransferSolWithSeedIxAccounts, TransferSolWithSeedInstructionArgs as TransferSolWithSeedIxData, UpgradeNonceAccount as UpgradeNonceAccountIxAccounts, - UpgradeNonceAccountInstructionArgs as UpgradeNonceAccountIxData, WithdrawNonceAccount as WithdrawNonceAccountIxAccounts, WithdrawNonceAccountInstructionArgs as WithdrawNonceAccountIxData, }; -use system_program_sdk::ID; +use codama_renderers_rust_e2e_system::ID; /// System Instructions #[derive(Debug)] @@ -38,7 +35,7 @@ pub enum SystemProgramIx { Assign(AssignIxAccounts, AssignIxData), TransferSol(TransferSolIxAccounts, TransferSolIxData), CreateAccountWithSeed(CreateAccountWithSeedIxAccounts, CreateAccountWithSeedIxData), - AdvanceNonceAccount(AdvanceNonceAccountIxAccounts, AdvanceNonceAccountIxData), + AdvanceNonceAccount(AdvanceNonceAccountIxAccounts), WithdrawNonceAccount(WithdrawNonceAccountIxAccounts, WithdrawNonceAccountIxData), InitializeNonceAccount( InitializeNonceAccountIxAccounts, @@ -49,7 +46,7 @@ pub enum SystemProgramIx { AllocateWithSeed(AllocateWithSeedIxAccounts, AllocateWithSeedIxData), AssignWithSeed(AssignWithSeedIxAccounts, AssignWithSeedIxData), TransferSolWithSeed(TransferSolWithSeedIxAccounts, TransferSolWithSeedIxData), - UpgradeNonceAccount(UpgradeNonceAccountIxAccounts, UpgradeNonceAccountIxData), + UpgradeNonceAccount(UpgradeNonceAccountIxAccounts), } #[derive(Debug, Copy, Clone)] @@ -99,39 +96,39 @@ impl InstructionParser { match ix_discriminator { [0] => { check_min_accounts_req(accounts_len, 2)?; - let de_ix_data: CreateAccountIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = CreateAccountIxAccounts { - payer: ix.accounts[0], - new_account: ix.accounts[1], + payer: ix.accounts[0].0.into(), + new_account: ix.accounts[1].0.into(), }; + let de_ix_data: CreateAccountIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::CreateAccount(ix_accounts, de_ix_data)) } [1] => { check_min_accounts_req(accounts_len, 1)?; - let de_ix_data: AssignIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = AssignIxAccounts { - account: ix.accounts[0], + account: ix.accounts[0].0.into(), }; + let de_ix_data: AssignIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::Assign(ix_accounts, de_ix_data)) } [2] => { check_min_accounts_req(accounts_len, 2)?; - let de_ix_data: TransferSolIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = TransferSolIxAccounts { - source: ix.accounts[0], - destination: ix.accounts[1], + source: ix.accounts[0].0.into(), + destination: ix.accounts[1].0.into(), }; + let de_ix_data: TransferSolIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::TransferSol(ix_accounts, de_ix_data)) } [3] => { check_min_accounts_req(accounts_len, 3)?; - let de_ix_data: CreateAccountWithSeedIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = CreateAccountWithSeedIxAccounts { - payer: ix.accounts[0], - new_account: ix.accounts[1], - base_account: ix.accounts[2], + payer: ix.accounts[0].0.into(), + new_account: ix.accounts[1].0.into(), + base_account: ix.accounts[2].0.into(), }; + let de_ix_data: CreateAccountWithSeedIxData = + BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::CreateAccountWithSeed( ix_accounts, de_ix_data, @@ -139,29 +136,24 @@ impl InstructionParser { } [4] => { check_min_accounts_req(accounts_len, 3)?; - let de_ix_data: AdvanceNonceAccountIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = AdvanceNonceAccountIxAccounts { - nonce_account: ix.accounts[0], - recent_blockhashes_sysvar: ix.accounts[1], - nonce_authority: ix.accounts[2], + nonce_account: ix.accounts[0].0.into(), + recent_blockhashes_sysvar: ix.accounts[1].0.into(), + nonce_authority: ix.accounts[2].0.into(), }; - Ok(SystemProgramIx::AdvanceNonceAccount( - ix_accounts, - de_ix_data, - )) + Ok(SystemProgramIx::AdvanceNonceAccount(ix_accounts)) } [5] => { check_min_accounts_req(accounts_len, 5)?; - let de_ix_data: WithdrawNonceAccountIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = WithdrawNonceAccountIxAccounts { - nonce_account: ix.accounts[0], - recipient_account: ix.accounts[1], - recent_blockhashes_sysvar: ix.accounts[2], - rent_sysvar: ix.accounts[3], - nonce_authority: ix.accounts[4], + nonce_account: ix.accounts[0].0.into(), + recipient_account: ix.accounts[1].0.into(), + recent_blockhashes_sysvar: ix.accounts[2].0.into(), + rent_sysvar: ix.accounts[3].0.into(), + nonce_authority: ix.accounts[4].0.into(), }; + let de_ix_data: WithdrawNonceAccountIxData = + BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::WithdrawNonceAccount( ix_accounts, de_ix_data, @@ -169,13 +161,13 @@ impl InstructionParser { } [6] => { check_min_accounts_req(accounts_len, 3)?; - let de_ix_data: InitializeNonceAccountIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = InitializeNonceAccountIxAccounts { - nonce_account: ix.accounts[0], - recent_blockhashes_sysvar: ix.accounts[1], - rent_sysvar: ix.accounts[2], + nonce_account: ix.accounts[0].0.into(), + recent_blockhashes_sysvar: ix.accounts[1].0.into(), + rent_sysvar: ix.accounts[2].0.into(), }; + let de_ix_data: InitializeNonceAccountIxData = + BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::InitializeNonceAccount( ix_accounts, de_ix_data, @@ -183,12 +175,12 @@ impl InstructionParser { } [7] => { check_min_accounts_req(accounts_len, 2)?; - let de_ix_data: AuthorizeNonceAccountIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = AuthorizeNonceAccountIxAccounts { - nonce_account: ix.accounts[0], - nonce_authority: ix.accounts[1], + nonce_account: ix.accounts[0].0.into(), + nonce_authority: ix.accounts[1].0.into(), }; + let de_ix_data: AuthorizeNonceAccountIxData = + BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::AuthorizeNonceAccount( ix_accounts, de_ix_data, @@ -196,40 +188,40 @@ impl InstructionParser { } [8] => { check_min_accounts_req(accounts_len, 1)?; - let de_ix_data: AllocateIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = AllocateIxAccounts { - new_account: ix.accounts[0], + new_account: ix.accounts[0].0.into(), }; + let de_ix_data: AllocateIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::Allocate(ix_accounts, de_ix_data)) } [9] => { check_min_accounts_req(accounts_len, 2)?; - let de_ix_data: AllocateWithSeedIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = AllocateWithSeedIxAccounts { - new_account: ix.accounts[0], - base_account: ix.accounts[1], + new_account: ix.accounts[0].0.into(), + base_account: ix.accounts[1].0.into(), }; + let de_ix_data: AllocateWithSeedIxData = + BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::AllocateWithSeed(ix_accounts, de_ix_data)) } [10] => { check_min_accounts_req(accounts_len, 2)?; - let de_ix_data: AssignWithSeedIxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = AssignWithSeedIxAccounts { - account: ix.accounts[0], - base_account: ix.accounts[1], + account: ix.accounts[0].0.into(), + base_account: ix.accounts[1].0.into(), }; + let de_ix_data: AssignWithSeedIxData = BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::AssignWithSeed(ix_accounts, de_ix_data)) } [11] => { check_min_accounts_req(accounts_len, 3)?; - let de_ix_data: TransferSolWithSeedIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = TransferSolWithSeedIxAccounts { - source: ix.accounts[0], - base_account: ix.accounts[1], - destination: ix.accounts[2], + source: ix.accounts[0].0.into(), + base_account: ix.accounts[1].0.into(), + destination: ix.accounts[2].0.into(), }; + let de_ix_data: TransferSolWithSeedIxData = + BorshDeserialize::deserialize(&mut ix_data)?; Ok(SystemProgramIx::TransferSolWithSeed( ix_accounts, de_ix_data, @@ -237,15 +229,10 @@ impl InstructionParser { } [12] => { check_min_accounts_req(accounts_len, 1)?; - let de_ix_data: UpgradeNonceAccountIxData = - BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = UpgradeNonceAccountIxAccounts { - nonce_account: ix.accounts[0], + nonce_account: ix.accounts[0].0.into(), }; - Ok(SystemProgramIx::UpgradeNonceAccount( - ix_accounts, - de_ix_data, - )) + Ok(SystemProgramIx::UpgradeNonceAccount(ix_accounts)) } _ => Err(yellowstone_vixen_core::ParseError::from( "Invalid Instruction discriminator".to_owned(), diff --git a/packages/renderers-vixen-parser/e2e/system/src/generated/mod.rs b/packages/renderers-vixen-parser/e2e/system_parser/src/generated/mod.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/system/src/generated/mod.rs rename to packages/renderers-vixen-parser/e2e/system_parser/src/generated/mod.rs diff --git a/packages/renderers-vixen-parser/e2e/system/src/lib.rs b/packages/renderers-vixen-parser/e2e/system_parser/src/lib.rs similarity index 100% rename from packages/renderers-vixen-parser/e2e/system/src/lib.rs rename to packages/renderers-vixen-parser/e2e/system_parser/src/lib.rs diff --git a/packages/renderers-vixen-parser/public/templates/accountsParserPage.njk b/packages/renderers-vixen-parser/public/templates/accountsParserPage.njk index 1f1a1821..d7383e0d 100644 --- a/packages/renderers-vixen-parser/public/templates/accountsParserPage.njk +++ b/packages/renderers-vixen-parser/public/templates/accountsParserPage.njk @@ -18,13 +18,26 @@ pub enum {{ programName | pascalCase }}ProgramState { impl {{ programName | pascalCase }}ProgramState { pub fn try_unpack(data_bytes:&[u8]) -> yellowstone_vixen_core::ParseResult{ let data_len = data_bytes.len(); + {% for account in accounts %} + {% if account.size == null %} + const {{ account.name | upper }}_LEN:usize = std::mem::size_of::<{{ account.name | pascalCase }}>(); + {% endif %} + {% endfor %} match data_len { {% for account in accounts %} - {{ account.name | pascalCase }}::LEN => Ok( - {{ programName | pascalCase }}ProgramState::{{ account.name | pascalCase }}( - {{ account.name | pascalCase }}::from_bytes(data_bytes)? - ) - ), + {% if account.size != null %} + {{ account.name | pascalCase }}::LEN => Ok( + {{ programName | pascalCase }}ProgramState::{{ account.name | pascalCase }}( + {{ account.name | pascalCase }}::from_bytes(data_bytes)? + ) + ), + {% else %} + {{account.name | upper }}_LEN => Ok( + {{ programName | pascalCase }}ProgramState::{{ account.name | pascalCase }}( + {{ account.name | pascalCase }}::from_bytes(data_bytes)? + ) + ), + {% endif %} {% endfor %} _ => Err(yellowstone_vixen_core::ParseError::from("Invalid Account data length".to_owned())), } diff --git a/packages/renderers-vixen-parser/public/templates/instructionsParserPage.njk b/packages/renderers-vixen-parser/public/templates/instructionsParserPage.njk index aff5d878..91c640b6 100644 --- a/packages/renderers-vixen-parser/public/templates/instructionsParserPage.njk +++ b/packages/renderers-vixen-parser/public/templates/instructionsParserPage.njk @@ -62,13 +62,17 @@ impl InstructionParser { {% if instruction.discriminator != null %} {{ instruction.discriminator }} => { check_min_accounts_req(accounts_len, {{ instruction.accounts | length }})?; - let de_ix_data:{{ instruction.name | pascalCase }}IxData = BorshDeserialize::deserialize(&mut ix_data)?; let ix_accounts = {{ instruction.name | pascalCase }}IxAccounts{ {% for account in instruction.accounts %} - {{ account.name | snakeCase }}: ix.accounts[{{ account.index }}], + {{ account.name | snakeCase }}: ix.accounts[{{ account.index }}].0.into(), {% endfor %} }; - Ok({{ programName | pascalCase }}ProgramIx::{{ instruction.name | pascalCase }}(ix_accounts, de_ix_data)) + {% if instruction.hasArgs %} + let de_ix_data:{{ instruction.name | pascalCase }}IxData = BorshDeserialize::deserialize(&mut ix_data)?; + Ok({{ programName | pascalCase }}ProgramIx::{{ instruction.name | pascalCase }}(ix_accounts, de_ix_data)) + {% else %} + Ok({{ programName | pascalCase }}ProgramIx::{{ instruction.name | pascalCase }}(ix_accounts)) + {% endif %} }, {% endif %} {% endfor %} diff --git a/packages/renderers-vixen-parser/src/getRenderMapVisitor.ts b/packages/renderers-vixen-parser/src/getRenderMapVisitor.ts index c456c954..148693fb 100644 --- a/packages/renderers-vixen-parser/src/getRenderMapVisitor.ts +++ b/packages/renderers-vixen-parser/src/getRenderMapVisitor.ts @@ -17,12 +17,13 @@ import { ImportMap } from './ImportMap'; export type GetRenderMapOptions = { linkOverrides?: LinkOverrides; renderParentInstructions?: boolean; - codamaSdkName?: string; + sdkName?: string; }; // Account node for the parser type ParserAccountNode = { name: string; + size: number | null; }; // Instruction Accounts node for the parser @@ -60,6 +61,7 @@ export function getRenderMapVisitor(options: GetRenderMapOptions = {}) { const accounts: ParserAccountNode[] = programAccounts.map(acc => { return { name: acc.name, + size: acc.size?.valueOf() ?? null, }; }); const programInstructions = getAllInstructionsWithSubs(node, { @@ -95,10 +97,12 @@ export function getRenderMapVisitor(options: GetRenderMapOptions = {}) { } } + const hasArgs = discriminator ? ix.arguments.length > 1 : ix.arguments.length > 0; + return { discriminator, name: ix.name, - hasArgs: ix.arguments.length > 0, + hasArgs, accounts: ix.accounts.map((acc, accIdx) => { return { name: acc.name, @@ -109,14 +113,14 @@ export function getRenderMapVisitor(options: GetRenderMapOptions = {}) { }); // TODO: assuming name of codama generated sdk to be {program_name}_program_sdk for now need to change it - const codamaSdkName = options.codamaSdkName ?? `${toSnakeCase(programName)}_program_sdk`; + const codamaSdkName = options.sdkName + ? toSnakeCase(options.sdkName) + : `${toSnakeCase(programName)}_program_sdk`; const accountParserImports = new ImportMap(); accounts.forEach(acc => { - accountParserImports.add( - `${codamaSdkName}::accounts::{${toSnakeCase(acc.name)}::${fromCamelToPascalCase(acc.name)}}`, - ); + accountParserImports.add(`${codamaSdkName}::accounts::${fromCamelToPascalCase(acc.name)}`); }); const instructionParserImports = new ImportMap(); @@ -133,7 +137,6 @@ export function getRenderMapVisitor(options: GetRenderMapOptions = {}) { instructions.forEach(ix => { const ixPascalName = fromCamelToPascalCase(ix.name); const ixAccounts = `${ixPascalName} as ${ixPascalName}IxAccounts`; - if (ix.hasArgs) { // Adding alias for IxData const ixData = `${ixPascalName}InstructionArgs as ${ixPascalName}IxData`; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 14607d21..80b19588 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -268,6 +268,9 @@ importers: '@codama/nodes': specifier: workspace:* version: link:../nodes + '@codama/nodes-from-anchor': + specifier: workspace:* + version: link:../nodes-from-anchor '@codama/renderers-core': specifier: workspace:* version: link:../renderers-core