From 42737a1aca55c04bde4cd4ddcd02a6636c05984d Mon Sep 17 00:00:00 2001 From: Reza Barazesh Date: Wed, 29 May 2019 13:29:51 -0700 Subject: [PATCH] Add support for sapling transactions --- lib/transactions.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/transactions.js b/lib/transactions.js index 3f556a825..02aa56527 100644 --- a/lib/transactions.js +++ b/lib/transactions.js @@ -76,7 +76,7 @@ TxController.prototype.transformTransaction = function(transaction, options, cal transformed.vout = transaction.outputs.map(this.transformOutput.bind(this, options)); - if (transformed.version >= 2 || transformed.version == -3) { + if (transformed.version >= 2 || transformed.version <= -3) { transformed.vjoinsplit = transaction.joinSplits.map(this.transformJoinSplit.bind(this, options)); } @@ -101,6 +101,18 @@ TxController.prototype.transformTransaction = function(transaction, options, cal transformed.fees = transaction.feeSatoshis / 1e8; } + // Sapling START + if (transaction.version <= -4) { + transformed.nExpiryHeight = transaction.nExpiryHeight; + transformed.valueBalance = transaction.valueBalance; + transformed.spendDescs = transaction.spendDescs; + transformed.outputDescs = transaction.outputDescs; + if (transaction.bindingSig) { + transformed.bindingSig = transaction.bindingSig; + } + } + // Sapling END + callback(null, transformed); };