getAccounts method

  1. @override
MessageAccountKeys getAccounts({
  1. List<AddressLookupTableAccount> addressLookupTableAccounts = const [],
  2. AccountLookupKeys? lookupKeys,
})
override

Gets the accounts associated with the message.

Implementation

@override
MessageAccountKeys getAccounts({
  List<AddressLookupTableAccount> addressLookupTableAccounts = const [],
  AccountLookupKeys? lookupKeys,
}) {
  if (lookupKeys != null) {
    if (numAccountKeysFromLookups !=
        lookupKeys.writable.length + lookupKeys.readonly.length) {
      throw const SolanaPluginException(
          'Failed to get account keys because of a mismatch in the number of account keys from lookups');
    }
  } else if (addressLookupTableAccounts.isNotEmpty) {
    lookupKeys = _resolveAddressTableLookups(addressLookupTableAccounts);
  } else if (addressTableLookups.isNotEmpty) {
    throw const SolanaPluginException(
        'Failed to get account keys because address table lookups were not resolved');
  }
  return MessageAccountKeys(accountKeys, lookupKeys);
}