getTwitterRegistry static method

Future<NameRegistryAccount> getTwitterRegistry({
  1. required SolanaRPC rpc,
  2. required String twitterHandle,
})

Implementation

static Future<NameRegistryAccount> getTwitterRegistry({
  required SolanaRPC rpc,
  required String twitterHandle,
}) async {
  final hashedTwitterHandle =
      NameServiceProgramUtils.getHashedName(twitterHandle);
  final twitterHandleRegistryKey =
      NameServiceProgramUtils.getNameAccountProgram(
    hashedName: hashedTwitterHandle,
    nameParent: NameServiceProgramConst.twitterRootPrentRegisteryKey,
  );
  final registry = await rpc.request(
      SolanaRPCNameRegistryAccount(account: twitterHandleRegistryKey));
  if (registry == null) {
    throw const MessageException("Account not found.");
  }

  return registry;
}