tronbox
Version:
TronBox - Simple development framework for Tron
1 lines • 892 B
JavaScript
;var _waitForTransactionReceipt=function waitForTransactionReceipt(tronWeb){return function(){var txHash=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var interval=arguments.length>1&&arguments[1]!==undefined?arguments[1]:500;var _transactionReceiptAsync=function transactionReceiptAsync(resolve,reject){tronWeb.trx.getTransactionInfo(txHash).then(function(receipt){if(!receipt||JSON.stringify(receipt)==="{}"){setTimeout(function(){return _transactionReceiptAsync(resolve,reject)},interval)}else{resolve(receipt)}})["catch"](function(error){reject(error)})};if(Array.isArray(txHash)){return Promise.all(txHash.map(function(oneTxHash){return _waitForTransactionReceipt(oneTxHash,interval)}))}else if(typeof txHash==="string"){return new Promise(_transactionReceiptAsync)}else{throw new Error("Invalid Type: "+txHash)}}};module.exports=_waitForTransactionReceipt;