createClientWithInterfacesFromRpc
Creates a client from a raw Rpc object, filling in whichever client interfaces the RPC supports.
The returned object's type implements a ClientWithGetMinimumBalance when the RPC supports the GetMinimumBalanceForRentExemptionApi, and a ClientWithFetchAccounts when it supports both the GetAccountInfoApi and the GetMultipleAccountsApi. The return type reflects the interfaces available on the provided RPC, so you only get the interfaces your RPC can actually back.
Because a raw Rpc object's capabilities cannot be detected at runtime, the returned object
always carries both getMinimumBalance and fetchAccounts at runtime; the return type is what
narrows them to the interfaces your RPC declares. Invoking a method that your Rpc does not
actually support will fail when the underlying RPC method is called.
Note that this does not create a fully-fledged Kit client — it only wraps the RPC in the account
interfaces above. To build a complete client, use createClient().use(solanaRpc(...)) instead,
which additionally exposes the underlying RPC and other capabilities.
Type Parameters
| Type Parameter |
|---|
TRpc extends | Rpc<GetMinimumBalanceForRentExemptionApi> | Rpc<GetAccountInfoApi & GetMultipleAccountsApi> |
Parameters
| Parameter | Type | Description |
|---|---|---|
rpc | TRpc | A raw Rpc object that supports either the GetMinimumBalanceForRentExemptionApi, or both the GetAccountInfoApi and the GetMultipleAccountsApi (otherwise no interface can be produced). The interfaces exposed on the returned client's type depend on which RPC methods it supports. |
Returns
ClientInterfacesFromRpc<TRpc>