Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Jan 10, 2024
1 parent 15ddbc8 commit 262663a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions token/program-2022/src/offchain.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
//! Offchain helper for fetching required accounts to build instructions
pub use spl_transfer_hook_interface::offchain::{AccountDataResult, AccountFetchError};
#[allow(deprecated)]
use {
crate::{
extension::{transfer_hook, StateWithExtensions},
state::Mint,
},
solana_program::{instruction::Instruction, program_error::ProgramError, pubkey::Pubkey},
spl_transfer_hook_interface::offchain::resolve_extra_account_metas,
std::future::Future,
};

Expand All @@ -34,7 +32,6 @@ use {
/// &mint,
/// ).await?;
/// ```
#[allow(deprecated)]
pub async fn resolve_extra_transfer_account_metas<F, Fut>(
instruction: &mut Instruction,
fetch_account_data_fn: F,
Expand All @@ -49,7 +46,8 @@ where
.ok_or(ProgramError::InvalidAccountData)?;
let mint = StateWithExtensions::<Mint>::unpack(&mint_data)?;
if let Some(program_id) = transfer_hook::get_program_id(&mint) {
resolve_extra_account_metas(
#[allow(deprecated)]
spl_transfer_hook_interface::offchain::resolve_extra_account_metas(
instruction,
fetch_account_data_fn,
mint_address,
Expand Down
10 changes: 10 additions & 0 deletions token/transfer-hook/interface/src/offchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ where
/// Offchain helper to get all additional required account metas for an execute
/// instruction, based on a validation state account.
///
/// The instruction being provided to this function must contain at least the
/// same account keys as the ones being provided, in order. Specifically:
/// 1. source
/// 2. mint
/// 3. destination
/// 4. authority
///
/// The `program_id` should be the program ID of the program that the
/// created `ExecuteInstruction` is for.
///
/// To be client-agnostic and to avoid pulling in the full solana-sdk, this
/// simply takes a function that will return its data as `Future<Vec<u8>>` for
/// the given address. Can be called in the following way:
Expand Down

0 comments on commit 262663a

Please sign in to comment.