createClientWithFetchAccountsFromRpc
Creates a ClientWithFetchAccounts from a raw Rpc object.
The returned client fetches the encoded content of accounts from their addresses, dispatching on the number of requested addresses: a single account is fetched via the getAccountInfo RPC method, whilst multiple accounts are fetched in a single round-trip via the getMultipleAccounts RPC method. Fetching an empty list short-circuits to an empty array without issuing any RPC call.
The dispatch is based purely on the number of addresses because a raw Rpc object's capabilities
cannot be detected at runtime. For this reason, the Rpc is required to support both methods.
This is a convenience helper for consumers that only have a raw Rpc object rather than a Kit
client. If you are building a full client, prefer composing it with a plugin such as solanaRpc
(i.e. createClient().use(solanaRpc(...))), which provides account fetching amongst other
capabilities.
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc | Rpc<GetAccountInfoApi & GetMultipleAccountsApi> | An object that supports both the GetAccountInfoApi and the GetMultipleAccountsApi of the Solana RPC API. |