{"version":3,"sources":["jsdelivr-header.js","/npm/node-red-contrib-iota-lib@0.2.6/iota-transactions.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,KAAO,QAAQ,eACf,KAAO,QAAQ,mBAErB,OAAO,QAAU,SAAS,GAmDtB,EAAI,MAAM,aAAa,oBAlDvB,SAA0B,GACtB,EAAI,MAAM,WAAW,KAAK,GAC1B,IAAI,EAAO,KACX,EAAK,KAAO,EACb,EAAK,WAAa,GACjB,IAAI,EAAY,GAChB,KAAK,SAAW,EAAI,MAAM,QAAQ,EAAO,UACzC,MAAM,EAAO,IAAI,KAAK,CAAC,KAAQ,KAAK,SAAS,KAAM,KAAQ,KAAK,SAAS,OACzE,EAAK,WAAY,EAEjB,EAAK,GAAG,SAAS,SAAS,GACtB,GAAI,KAAK,UAAW,CAClB,QAAQ,IAAI,iDACZ,KAAK,WAAY,EACjB,IAAI,EAAO,KACX,KAAK,OAAO,CAAC,KAAK,MAAM,MAAM,OAAO,KAAK,eAGxC,EADE,EAAK,MAAM,OAAO,EAAI,SACZ,EAAI,QAEJ,EAAO,SAErB,QAAQ,IAAI,eAAe,GAC3B,EAAK,IAAI,uBAAuB,CAAC,IAAY,CAAC,EAAO,KAE/C,GACA,QAAQ,IAAI,GACX,EAAI,QAAQ,EACZ,EAAK,KAAK,KAER,QAAQ,IAAI,GACV,EAAI,QAAQ,EACZ,EAAK,IAAI,mBAAmB,CAAC,IAAY,SAAS,EAAI,GAC9C,GACA,QAAQ,MAAM,GACd,EAAI,QAAQ,EACZ,EAAK,KAAK,KAEV,QAAQ,IAAI,GACZ,EAAI,QAAQ,GAAG,UAAU,EAAI,GAC7B,EAAK,KAAK,GAElB,KAET,KAAK,OAAO,CAAC,GACb,EAAK,WAAY,CAAI,GAEzB,CACJ,GACJ,GAEJ","file":"/npm/node-red-contrib-iota-lib@0.2.6/iota-transactions.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-red-contrib-iota-lib@0.2.6/iota-transactions.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const IOTA = require('iota.lib.js');\nconst TRAN = require('transliteration');\n\nmodule.exports = function(RED) {\n    function iotatransactions(config) {\n        RED.nodes.createNode(this,config);\n        var node = this;\n        node._sec = 2;\n\t      node._firstroot = '';\n        var iota_hash = '';\n        this.iotaNode = RED.nodes.getNode(config.iotaNode);\n        const iota = new IOTA({'host': this.iotaNode.host, 'port': this.iotaNode.port});\n        node.readyIota = true;\n\n        node.on('input', function(msg) {\n            if (this.readyIota) {\n              console.log(\"Searching dataset via getTransactionsObjects.\")\n              this.readyIota = false;\n              var self = this;\n              this.status({fill:\"red\",shape:\"ring\",text:\"connecting\"});\n\n              if (iota.valid.isHash(msg.payload)) {\n                iota_hash = msg.payload;\n              } else {\n                iota_hash = config.iotaHash;\n              }\n              console.log(\"Input HASH: \"+iota_hash);\n              iota.api.getTransactionsObjects([iota_hash], (error, success) => {\n                //console.log(\"Report from iota node:\")\n  \t\t            if (error) {\n    \t \t             console.log(error);\n                     msg.payload=error;\n                     self.send(msg);\n  \t\t               } else {\n    \t\t                 console.log(success);\n                         msg.payload=success;\n                         iota.api.getLatestInclusion([iota_hash], function(err,suc) {\n                             if (err) {\n                                 console.error(err);\n                                 msg.payload=err;\n                                 self.send(msg);\n                             } else {\n                                 console.log(suc);\n                                 msg.payload[0].confirmed=suc[0];\n                                 self.send(msg);\n                            }\n                         });\n  \t\t                   }\n                this.status({});\n                self.readyIota = true;\n\t             });\n            }\n        });\n    }\n    RED.nodes.registerType(\"iotatransactions\",iotatransactions);\n}\n"]}