Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move program::wasm::instructions to instruction crate #3874

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading