From f7afb9a91afd7e04bf01906ebf7b142409d116d8 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 23 Sep 2013 09:28:21 -0400 Subject: [PATCH] Transaction: helper to return parsed-out list of inputs --- Transaction.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Transaction.js b/Transaction.js index b4580b3..7c83c5d 100644 --- a/Transaction.js +++ b/Transaction.js @@ -181,6 +181,19 @@ function spec(b) { return this.hash; }; + // convert encoded list of inputs to easy-to-use JS list-of-lists + Transaction.prototype.inputs = function inputs() { + var res = []; + for (var i = 0; i < this.ins.length; i++) { + var txin = this.ins[i]; + var outHash = txin.getOutpointHash(); + var outIndex = txin.getOutpointIndex(); + res.push([outHash, outIndex]); + } + + return res; + } + /** * Load and cache transaction inputs. *