Skip to content

Commit 435d314

Browse files
committed
add to more programs
1 parent b8b7dcb commit 435d314

17 files changed

Lines changed: 122 additions & 69 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

program-tests/compressed-token-test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ default = []
2020
[dependencies]
2121
anchor-lang = { workspace = true }
2222
light-sdk = { workspace = true, features = ["anchor"] }
23+
light-instruction-decoder = { workspace = true }
2324

2425
[dev-dependencies]
2526
light-compressed-token = { workspace = true }

program-tests/compressed-token-test/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
#![allow(deprecated)]
44

55
use anchor_lang::{prelude::*, solana_program::instruction::Instruction};
6+
use light_instruction_decoder::instruction_decoder;
67

78
declare_id!("CompressedTokenTestProgram11111111111111111");
89

10+
#[instruction_decoder]
911
#[program]
1012
pub mod compressed_token_test {
1113
use super::*;

program-tests/create-address-test-program/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ account-compression = { workspace = true, features = ["cpi"] }
2727
light-compressed-account = { workspace = true, features = ["anchor"] }
2828
light-sdk = { workspace = true, features = ["anchor", "v2"] }
2929
light-sdk-types = { workspace = true }
30+
light-instruction-decoder = { workspace = true }

program-tests/create-address-test-program/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use anchor_lang::{
88
solana_program::{instruction::Instruction, pubkey::Pubkey},
99
InstructionData,
1010
};
11+
use light_instruction_decoder::instruction_decoder;
1112
use light_sdk::{
1213
cpi::{v2::CpiAccounts, CpiAccountsConfig, CpiSigner},
1314
derive_light_cpi_signer,
@@ -59,6 +60,7 @@ declare_id!("FNt7byTHev1k5x2cXZLBr8TdWiC3zoP5vcnZR4P682Uy");
5960
pub const LIGHT_CPI_SIGNER: CpiSigner =
6061
derive_light_cpi_signer!("FNt7byTHev1k5x2cXZLBr8TdWiC3zoP5vcnZR4P682Uy");
6162

63+
#[instruction_decoder]
6264
#[program]
6365
pub mod system_cpi_test {
6466

program-tests/system-cpi-test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ light-merkle-tree-metadata = { workspace = true, features = ["anchor"] }
3535
light-account-checks = { workspace = true }
3636
light-sdk = { workspace = true, features = ["v2", "cpi-context"] }
3737
light-sdk-types = { workspace = true, features = ["v2", "cpi-context"] }
38+
light-instruction-decoder = { workspace = true }
3839

3940
[target.'cfg(not(target_os = "solana"))'.dependencies]
4041
solana-sdk = { workspace = true }

program-tests/system-cpi-test/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use light_compressed_account::{
2424
data::{NewAddressParamsPacked, PackedReadOnlyAddress},
2525
},
2626
};
27+
use light_instruction_decoder::instruction_decoder;
2728
use light_sdk::derive_light_cpi_signer;
2829
use light_sdk_types::CpiSigner;
2930

@@ -32,6 +33,7 @@ declare_id!("FNt7byTHev1k5x2cXZLBr8TdWiC3zoP5vcnZR4P682Uy");
3233
pub const LIGHT_CPI_SIGNER: CpiSigner =
3334
derive_light_cpi_signer!("FNt7byTHev1k5x2cXZLBr8TdWiC3zoP5vcnZR4P682Uy");
3435

36+
#[instruction_decoder]
3537
#[program]
3638
pub mod system_cpi_test {
3739

sdk-libs/instruction-decoder-derive/src/attribute_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn instruction_decoder_attr(
102102
fn decode(
103103
&self,
104104
data: &[u8],
105-
_accounts: &[::solana_instruction::AccountMeta],
105+
_accounts: &[light_instruction_decoder::solana_instruction::AccountMeta],
106106
) -> Option<light_instruction_decoder::DecodedInstruction> {
107107
if data.len() < 8 {
108108
return None;

sdk-libs/instruction-decoder-derive/src/builder.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ impl<'a> InstructionDecoderBuilder<'a> {
288288
pub struct #decoder_name;
289289

290290
impl light_instruction_decoder::InstructionDecoder for #decoder_name {
291-
fn program_id(&self) -> ::solana_pubkey::Pubkey {
292-
::solana_pubkey::Pubkey::new_from_array(#program_id_bytes)
291+
fn program_id(&self) -> light_instruction_decoder::solana_pubkey::Pubkey {
292+
light_instruction_decoder::solana_pubkey::Pubkey::new_from_array(#program_id_bytes)
293293
}
294294

295295
fn program_name(&self) -> &'static str {
@@ -299,7 +299,7 @@ impl<'a> InstructionDecoderBuilder<'a> {
299299
fn decode(
300300
&self,
301301
data: &[u8],
302-
accounts: &[::solana_instruction::AccountMeta],
302+
accounts: &[light_instruction_decoder::solana_instruction::AccountMeta],
303303
) -> Option<light_instruction_decoder::DecodedInstruction> {
304304
if data.len() < #disc_size {
305305
return None;
@@ -320,8 +320,8 @@ impl<'a> InstructionDecoderBuilder<'a> {
320320
pub struct #decoder_name;
321321

322322
impl light_instruction_decoder::InstructionDecoder for #decoder_name {
323-
fn program_id(&self) -> ::solana_pubkey::Pubkey {
324-
::solana_pubkey::Pubkey::new_from_array(#program_id_bytes)
323+
fn program_id(&self) -> light_instruction_decoder::solana_pubkey::Pubkey {
324+
light_instruction_decoder::solana_pubkey::Pubkey::new_from_array(#program_id_bytes)
325325
}
326326

327327
fn program_name(&self) -> &'static str {
@@ -331,7 +331,7 @@ impl<'a> InstructionDecoderBuilder<'a> {
331331
fn decode(
332332
&self,
333333
data: &[u8],
334-
accounts: &[::solana_instruction::AccountMeta],
334+
accounts: &[light_instruction_decoder::solana_instruction::AccountMeta],
335335
) -> Option<light_instruction_decoder::DecodedInstruction> {
336336
if data.len() < 4 {
337337
return None;
@@ -352,8 +352,8 @@ impl<'a> InstructionDecoderBuilder<'a> {
352352
pub struct #decoder_name;
353353

354354
impl light_instruction_decoder::InstructionDecoder for #decoder_name {
355-
fn program_id(&self) -> ::solana_pubkey::Pubkey {
356-
::solana_pubkey::Pubkey::new_from_array(#program_id_bytes)
355+
fn program_id(&self) -> light_instruction_decoder::solana_pubkey::Pubkey {
356+
light_instruction_decoder::solana_pubkey::Pubkey::new_from_array(#program_id_bytes)
357357
}
358358

359359
fn program_name(&self) -> &'static str {
@@ -363,7 +363,7 @@ impl<'a> InstructionDecoderBuilder<'a> {
363363
fn decode(
364364
&self,
365365
data: &[u8],
366-
accounts: &[::solana_instruction::AccountMeta],
366+
accounts: &[light_instruction_decoder::solana_instruction::AccountMeta],
367367
) -> Option<light_instruction_decoder::DecodedInstruction> {
368368
if data.len() < 8 {
369369
return None;

sdk-libs/instruction-decoder-derive/src/parsing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,12 @@ impl ProgramIdSource {
367367
pub fn program_id_impl(&self) -> TokenStream2 {
368368
match self {
369369
ProgramIdSource::Bytes(bytes) => quote! {
370-
fn program_id(&self) -> ::solana_pubkey::Pubkey {
371-
::solana_pubkey::Pubkey::new_from_array(#bytes)
370+
fn program_id(&self) -> light_instruction_decoder::solana_pubkey::Pubkey {
371+
light_instruction_decoder::solana_pubkey::Pubkey::new_from_array(#bytes)
372372
}
373373
},
374374
ProgramIdSource::Path(path) => quote! {
375-
fn program_id(&self) -> ::solana_pubkey::Pubkey {
375+
fn program_id(&self) -> light_instruction_decoder::solana_pubkey::Pubkey {
376376
#path
377377
}
378378
},

0 commit comments

Comments
 (0)