Supply an array of string literals to define accounts having particular addresses.
Optionalconfig: FetchAccountsConfigconst myAddressA = address('1234..5678');
const myAddressB = address('8765..4321');
const [myAccountA, myAccountB] = await fetchEncodedAccounts(rpc, [myAddressA, myAddressB]);
myAccountA satisfies MaybeEncodedAccount<'1234..5678'>;
myAccountB satisfies MaybeEncodedAccount<'8765..4321'>;
// With custom configuration.
const [myAccountA, myAccountB] = await fetchEncodedAccounts(rpc, [myAddressA, myAddressB], {
abortSignal: myAbortController.signal,
commitment: 'confirmed',
});
Fetches an array of MaybeEncodedAccount | MaybeEncodedAccounts from the provided RPC client and an array of addresses.
It uses the GetMultipleAccountsApi#getMultipleAccounts | getMultipleAccounts RPC method under the hood with base64 encodings and an additional configuration object can be provided to customize the behavior of the RPC call.