• Fetches a MaybeEncodedAccount from the provided RPC client and address.

    It uses the GetAccountInfoApi.getAccountInfo | getAccountInfo RPC method under the hood with base64 encoding and an additional configuration object can be provided to customize the behavior of the RPC call.

    Type Parameters

    • TAddress extends string = string

      Supply a string literal to define an account having a particular address.

    Parameters

    Returns Promise<MaybeEncodedAccount<TAddress>>

    const myAddress = address('1234..5678');
    const myAccount: MaybeEncodedAccount<'1234..5678'> = await fetchEncodedAccount(rpc, myAddress);

    // With custom configuration.
    const myAccount: MaybeEncodedAccount<'1234..5678'> = await fetchEncodedAccount(rpc, myAddress, {
    abortSignal: myAbortController.signal,
    commitment: 'confirmed',
    });