Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 2c1a671

Browse files
author
Tyera Eulberg
authored
Make spl-token-2022 instruction decoders pub (#3112)
* Make instruction decoders pub * Add missing doc
1 parent 2491b29 commit 2c1a671

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

token/program-2022/src/extension/default_account_state/instruction.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ pub enum DefaultAccountStateInstruction {
5353
Update,
5454
}
5555

56-
pub(crate) fn decode_instruction(
56+
/// Utility function for decoding a DefaultAccountState instruction and its data
57+
pub fn decode_instruction(
5758
input: &[u8],
5859
) -> Result<(DefaultAccountStateInstruction, AccountState), ProgramError> {
5960
if input.len() != 2 {

token/program-2022/src/instruction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ pub fn is_valid_signer_index(index: usize) -> bool {
16901690
}
16911691

16921692
/// Utility function for decoding just the instruction type
1693-
pub(crate) fn decode_instruction_type<T: TryFrom<u8>>(input: &[u8]) -> Result<T, ProgramError> {
1693+
pub fn decode_instruction_type<T: TryFrom<u8>>(input: &[u8]) -> Result<T, ProgramError> {
16941694
if input.is_empty() {
16951695
Err(ProgramError::InvalidInstructionData)
16961696
} else {
@@ -1699,7 +1699,7 @@ pub(crate) fn decode_instruction_type<T: TryFrom<u8>>(input: &[u8]) -> Result<T,
16991699
}
17001700

17011701
/// Utility function for decoding instruction data
1702-
pub(crate) fn decode_instruction_data<T: Pod>(input: &[u8]) -> Result<&T, ProgramError> {
1702+
pub fn decode_instruction_data<T: Pod>(input: &[u8]) -> Result<&T, ProgramError> {
17031703
if input.len() != pod_get_packed_len::<T>().saturating_add(1) {
17041704
Err(ProgramError::InvalidInstructionData)
17051705
} else {

0 commit comments

Comments
 (0)