fix(getPublicKey): Switching from GET to POST calls, to pass usrObj

This commit is contained in:
Chris Troutner
2021-03-08 18:36:27 -08:00
parent cf86e390fb
commit 137cacd1da
3 changed files with 80 additions and 69 deletions
+2 -4
View File
@@ -135,16 +135,14 @@ class Encryption {
for (let i = 0; i < txids.length; i++) {
const thisTx = txids[i]
// CT 2/24/21: I might want to convert this to the POST call, to take
// advantage of the usrObj. It does not get passed in a GET call.
const txDetails = await _this.bchjs.RawTransactions.getRawTransaction(
thisTx,
[thisTx],
true,
usrObj
)
// console.log(`txDetails: ${JSON.stringify(txDetails, null, 2)}`)
const vin = txDetails.vin
const vin = txDetails[0].vin
// Loop through each input.
for (let j = 0; j < vin.length; j++) {
+3 -3
View File
@@ -82,7 +82,7 @@ describe('#Encryption Router', () => {
.resolves(mockData.mockFulcrumTxHistory)
sandbox
.stub(encryptionRoute.bchjs.RawTransactions, 'getRawTransaction')
.resolves(mockData.mockTxDetails2)
.resolves([mockData.mockTxDetails2])
}
const result = await encryptionRoute.getPublicKey(req, res)
@@ -110,7 +110,7 @@ describe('#Encryption Router', () => {
}
const result = await encryptionRoute.getPublicKey(req, res)
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
console.log(`result: ${JSON.stringify(result, null, 2)}`)
assert.property(result, 'success')
assert.equal(result.success, false)
@@ -130,7 +130,7 @@ describe('#Encryption Router', () => {
.resolves(mockData.mockFulcrumNoSendBalance)
sandbox
.stub(encryptionRoute.bchjs.RawTransactions, 'getRawTransaction')
.resolves(mockData.mockNoSendTx)
.resolves([mockData.mockNoSendTx])
}
const result = await encryptionRoute.getPublicKey(req, res)
+14 -1
View File
@@ -53,6 +53,8 @@ const mockNoSendTx = {
const mockFulcrumTxHistory = {
success: true,
transactions: [
{
transactions: [
{
height: 511463,
@@ -115,6 +117,8 @@ const mockFulcrumTxHistory = {
'c42f8f16d3baa2ee343ea89ef110dfe094992379d08edd30887b8ca7ee671c9a'
}
]
}
]
}
const mockTxDetails2 = {
@@ -159,11 +163,18 @@ const mockTxDetails2 = {
const mockFulcrumNoTxHistory = {
success: true,
transactions: []
transactions: [
{
transactions: [],
address: 'bitcoincash:qrgqqkky28jdkv3w0ctrah0mz3jcsnsklc34gtukrh'
}
]
}
const mockFulcrumNoSendBalance = {
success: true,
transactions: [
{
transactions: [
{
height: 633578,
@@ -171,6 +182,8 @@ const mockFulcrumNoSendBalance = {
'a3b62cd4f4c56ba52139179db14bffd4ab22a2e077f3c62bd5cf0541bfcaf023'
}
]
}
]
}
module.exports = {