In this code client.createTransaction() function returns result1.txid. From that result1.txid i want  to run while loop and inside that while loop I want to client.getTx() repeatably untill i get status == 1 or -1. Here i cant able to run the while loop. It shows nothing,
var coinPay = require('coinpayments');
var fs = require('fs');
var async = require("async");
var client = new coinPay({
  'key': 'XYZsdgdfgdf',
  'secret': 'XYZsdfsdfsd',
  'autoIpn': true
});
client.createTransaction({
    'currency1': 'LTCT',
    'currency2': 'LTCT',
    'amount': 1
  }, (err, result1) => {
    while (true) {
      client.getTx(result1.txn_id, (err, result) => {
        console.log(result);
        if (result.status == -1) {
          console.log("unsuccesful");
          return;
        } else if (result.status == 1) {
          console.log("succesful");
          return;
        } else
          console.log("checking");
      })
    }
  }
)
 
    