Compare commits

...
2 Commits
Author SHA1 Message Date
Chris Troutner fe37c3ca43 Merge pull request #190 from Permissionless-Software-Foundation/ct-unstable
fix(Transaction.get2()): Improvement to vin token inputs
2021-10-31 18:56:09 -07:00
Chris Troutner ff4ffab670 fix(Transaction.get2()): Improvement to vin token inputs 2021-10-31 18:50:47 -07:00
2 changed files with 12 additions and 0 deletions
+2
View File
@@ -379,12 +379,14 @@ class Transaction {
thisVin.tokenId = inTokenData.tokenId
} else {
thisVin.tokenQty = null
thisVin.tokenQtyStr = null
}
} catch (err) {
// If decodeOpReturn() throws an error, then this input is not
// from an SLP transaction and can be ignored.
// thisVin.tokenQty = null
thisVin.tokenQty = null
thisVin.tokenQtyStr = null
continue
}
}
+10
View File
@@ -351,6 +351,10 @@ describe('#TransactionLib', () => {
assert.property(result.vin[0], 'value')
assert.property(result.vin[0], 'tokenQty')
// Assert that tokenIds and tokenQty are included in inputs.
assert.property(result.vin[0], 'tokenId')
assert.equal(result.vin[0].tokenQtyStr, '998834')
// Assert blockheight is added
assert.equal(result.blockheight, 603424)
})
@@ -419,6 +423,12 @@ describe('#TransactionLib', () => {
assert.equal(result.vin[0].tokenQty, 10000000)
assert.equal(result.vin[1].tokenQty, null)
// Assert that tokenIds and tokenQty are included in inputs.
assert.property(result.vin[0], 'tokenId')
assert.equal(result.vin[0].tokenQtyStr, '10000000')
assert.equal(result.vin[1].tokenQty, null)
assert.equal(result.vin[1].tokenQtyStr, null)
// Assert blockheight is added
assert.equal(result.blockheight, 543409)
})