src/utils/index.js
function getTransactionSuccess(eth, txHash, timeout = 800000, callback) {
  const cb = callback || function cb() {};
  let count = 0;
  return new Promise((resolve, reject) => {
    const txInterval = setInterval(() => {
      eth.getTransactionReceipt(txHash, (err, result) => {
        if (err) {
          clearInterval(txInterval);
          cb(err, null);
          reject(err);
        }

        if (!err && result) {
          clearInterval(txInterval);
          cb(null, result);
          resolve(result);
        }
      });

      if (count >= timeout) {
        clearInterval(txInterval);
        const errMessage = `Receipt timeout waiting for tx hash: ${txHash}`;
        cb(errMessage, null);
        reject(errMessage);
      }
      count += 7000;
    }, 7000);
  });
}
function getTransactionSuccess(eth, txHash, timeout = 800000, callback) {
  const cb = callback || function cb() {};
  let count = 0;
  return new Promise((resolve, reject) => {
    const txInterval = setInterval(() => {
      eth.getTransactionReceipt(txHash, (err, result) => {
        if (err) {
          clearInterval(txInterval);
          cb(err, null);
          reject(err);
        }

        if (!err && result) {
          clearInterval(txInterval);
          cb(null, result);
          resolve(result);
        }
      });

      if (count >= timeout) {
        clearInterval(txInterval);
        const errMessage = `Receipt timeout waiting for tx hash: ${txHash}`;
        cb(errMessage, null);
        reject(errMessage);
      }
      count += 7000;
    }, 7000);
  });
}
function getTransactionSuccess ( eth , txHash , timeout = 800000 , callback ) { const cb = callback || function cb ( ) { } ; let count = 0 ; return new Promise ( ( resolve , reject ) => { const txInterval = setInterval ( ( ) => { eth . getTransactionReceipt ( txHash , ( err , result ) => { if ( err ) { clearInterval ( txInterval ) ; cb ( err , null ) ; reject ( err ) ; } if ( ! err && result ) { clearInterval ( txInterval ) ; cb ( null , result ) ; resolve ( result ) ; } } ) ; if ( count >= timeout ) { clearInterval ( txInterval ) ; const errMessage = ` ${ txHash } ` ; cb ( errMessage , null ) ; reject ( errMessage ) ; } count += 7000 ; } , 7000 ) ; } ) ; }
This will wait for a transaction to present a receipt

@method getTransactionSuccess
@param {Object} eth the eth query instance
@param {Object} txHash the transaction hash
@param {Object} timeout settings
@param {Function} callback the final callback
@callback {Object} contractInstance the deployed contract instance with receipt prop
This will wait for a transaction to present a receipt