getAddressLookupTable method

Future<AddressLookupTableAccount> getAddressLookupTable(
  1. Ed25519HDPublicKey account
)

Implementation

Future<AddressLookupTableAccount> getAddressLookupTable(
  Ed25519HDPublicKey account,
) async {
  final accountInfo = await getAccountInfo(
    account.toBase58(),
    encoding: Encoding.base64,
  ).value;

  if (accountInfo == null) {
    throw const FormatException('Account not found');
  }

  final data = accountInfo.data;
  if (data == null) {
    throw const FormatException('Account data is null');
  }

  final input = ByteArray((data as BinaryAccountData).data);
  final decode = AddressLookupTableAccount.deserialize(input);

  return AddressLookupTableAccount(key: account, state: decode);
}