Skip to content

Commit

Permalink
move program::wasm::instructions to instruction crate (#3874)
Browse files Browse the repository at this point in the history
* move program::wasm::instructions to instruction crate

* fmt

* unify cfg usage
  • Loading branch information
kevinheavey authored Dec 3, 2024
1 parent 36d1017 commit 81a84cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions sdk/instruction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ pub use account_meta::AccountMeta;
pub mod error;
#[cfg(target_os = "solana")]
pub mod syscalls;
#[cfg(all(feature = "std", target_arch = "wasm32"))]
pub mod wasm;

/// A directive for a single invocation of a Solana program.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! The `Instructions` struct is a workaround for the lack of Vec<T> support in wasm-bindgen
//! The `Instructions` struct is a legacy workaround
//! from when wasm-bindgen lacked Vec<T> support
//! (ref: https://github.com/rustwasm/wasm-bindgen/issues/111)
#![cfg(target_arch = "wasm32")]
use {crate::instruction::Instruction, wasm_bindgen::prelude::*};
use {crate::Instruction, wasm_bindgen::prelude::*};

#[wasm_bindgen]
#[derive(Default)]
pub struct Instructions {
instructions: Vec<Instruction>,
instructions: std::vec::Vec<Instruction>,
}

#[wasm_bindgen]
Expand All @@ -21,7 +21,7 @@ impl Instructions {
}
}

impl From<Instructions> for Vec<Instruction> {
impl From<Instructions> for std::vec::Vec<Instruction> {
fn from(instructions: Instructions) -> Self {
instructions.instructions
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/program/src/wasm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! solana-program Javascript interface
#![cfg(target_arch = "wasm32")]
#[deprecated(since = "2.2.0", note = "Use solana_instruction::wasm instead.")]
pub use solana_instruction::wasm as instructions;
use wasm_bindgen::prelude::*;

pub mod instructions;
// This module is intentionally left empty. The wasm system instruction impl can be
// found in the `solana-system-interface` crate.
pub mod system_instruction {}
Expand Down

0 comments on commit 81a84cd

Please sign in to comment.