pub async fn resolve_extra_transfer_account_metas<F, Fut>(
instruction: &mut Instruction,
fetch_account_data_fn: F,
mint_address: &Pubkey
) -> Result<(), AccountFetchError>
Expand description
Offchain helper to get all additional required account metas for a checked transfer
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:
ⓘ
use futures_util::TryFutureExt;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;
let mint = Pubkey::new_unique();
let client = RpcClient::new_mock("succeeds".to_string());
let mut account_metas = vec![];
get_extra_transfer_account_metas(
&mut account_metas,
|address| self.client.get_account(&address).map_ok(|opt| opt.map(|acc| acc.data)),
&mint,
).await?;