checkDeployed method
Check that the program has been deployed to the cluster and is an executable program.
Throws a ProgramException if pubkey does not refer to a valid program.
Implementation
Future<void> checkDeployed(final Connection connection) async {
  final AccountInfo? programInfo = await connection.getAccountInfo(pubkey);
  if (programInfo == null) {
    throw ProgramException(
      'The program $runtimeType ($pubkey) has not been deployed.',
    );
  } else if (!programInfo.executable) {
    throw ProgramException(
      'The program $runtimeType ($pubkey) is not executable.',
    );
  }
}