From 2e56d66f48602d0e70ae1fc8f0db387e406b21fc Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 21 Oct 2021 19:42:12 -0700 Subject: [PATCH] fix(Transaction.get()): Fixing bug in previous PR --- src/transaction.js | 6 +++++- test/unit/transaction-unit.js | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index 679c663..7597f55 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -129,7 +129,11 @@ class Transaction { } } else if (inTokenData.txType === 'MINT') { // vout=1 (second output) recieves the newly minted tokens. - tokenQty = inTokenData.qty + if (i === 1) { + tokenQty = inTokenData.qty + } else { + tokenQty = null + } // } else { diff --git a/test/unit/transaction-unit.js b/test/unit/transaction-unit.js index a54de35..9388d55 100644 --- a/test/unit/transaction-unit.js +++ b/test/unit/transaction-unit.js @@ -209,7 +209,9 @@ describe('#TransactionLib', () => { assert.equal(result.isValidSLPTx, true) // Assert inputs values unique to a Mint input have the proper values. - assert.equal(result.vin[2].tokenQty, 2.34123) + assert.equal(result.vin[0].tokenQty, 43545.34534) + assert.equal(result.vin[1].tokenQty, 2.34123) + assert.equal(result.vin[2].tokenQty, null) }) }) })