addSelfFetchFunctions
Adds self-fetching methods to a codec for retrieving and decoding accounts.
This function augments the provided codec with methods that allow it to fetch
accounts from the network and decode them in one step. It enables a fluent API
where you can call methods like .fetch() directly on the codec.
Type Parameters
| Type Parameter | Description |
|---|---|
TCodec extends AnyObjectCodec | The codec type being augmented. |
Parameters
| Parameter | Type | Description |
|---|---|---|
client | ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi> | A client that provides RPC access for fetching accounts. |
codec | TCodec | The codec to augment with self-fetch methods. |
Returns
SelfFetchFunctions<InferTFrom<TCodec>, InferTTo<TCodec>> & TCodec
The codec augmented with SelfFetchFunctions methods.
Examples
Adding self-fetch functions to an account codec.
Handling accounts that may not exist.
Fetching multiple accounts at once.