From 3700ef48d92972e3a79e79f22fabdf9cf99efdfb Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 10 Jan 2024 10:03:37 -0600 Subject: [PATCH] address review feedback --- token/program-2022/src/offchain.rs | 6 ++---- token/transfer-hook/interface/src/offchain.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/token/program-2022/src/offchain.rs b/token/program-2022/src/offchain.rs index e9efc876c66..921f23a466e 100644 --- a/token/program-2022/src/offchain.rs +++ b/token/program-2022/src/offchain.rs @@ -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, }; @@ -34,7 +32,6 @@ use { /// &mint, /// ).await?; /// ``` -#[allow(deprecated)] pub async fn resolve_extra_transfer_account_metas( instruction: &mut Instruction, fetch_account_data_fn: F, @@ -49,7 +46,8 @@ where .ok_or(ProgramError::InvalidAccountData)?; let mint = StateWithExtensions::::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, diff --git a/token/transfer-hook/interface/src/offchain.rs b/token/transfer-hook/interface/src/offchain.rs index 422867b7534..692f5dd53f3 100644 --- a/token/transfer-hook/interface/src/offchain.rs +++ b/token/transfer-hook/interface/src/offchain.rs @@ -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>` for /// the given address. Can be called in the following way: