ClientWithFetchAccounts
Represents a client that can fetch the content of accounts from their addresses.
Different implementations may fetch accounts differently — for example, by calling the
getAccountInfo and/or getMultipleAccounts RPC methods, by reading from a local validator,
or by using a locally cached value.
Note that this interface only fetches encoded accounts. Callers that need decoded accounts should decode the returned MaybeEncodedAccount | MaybeEncodedAccounts themselves using the codec of their choice.
If you have a raw Rpc object instead of a client, you can construct a client implementing this
interface using the createClientWithFetchAccountsFromRpc helper from @solana/kit.
Example
Properties
fetchAccounts
Fetches the encoded content of the accounts at the provided addresses.
The returned array matches the provided addresses in both length and order. Each item is a MaybeEncodedAccount so that missing accounts can be represented whilst keeping track of their address.
Parameters
| Parameter | Type | Description |
|---|---|---|
addresses | Address[] | The addresses of the accounts to fetch. |
config? | FetchAccountsConfig | Optional configuration for the fetch. |
Returns
Promise<MaybeEncodedAccount[]>
A promise resolving to an array of MaybeEncodedAccount | MaybeEncodedAccounts in the same order as the provided addresses.