Merge pull request #20 from christroutner/unstable

fix(gettxout): Uses new gettxout POST call
This commit is contained in:
Chris Troutner
2020-04-25 06:00:52 -07:00
committed by GitHub
2 changed files with 13 additions and 4 deletions
+11 -2
View File
@@ -612,8 +612,17 @@ class Blockchain {
throw new Error(`include_mempool input must be of type boolean`)
// Send the request to the REST API.
const response = await axios.get(
`${this.restURL}blockchain/getTxOut/${txid}/${n}?include_mempool=${include_mempool}`,
// const response = await axios.get(
// `${this.restURL}blockchain/getTxOut/${txid}/${n}?include_mempool=${include_mempool}`,
// _this.axiosOptions
// )
const response = await axios.post(
`${this.restURL}blockchain/getTxOut`,
{
txid: txid,
vout: n,
mempool: include_mempool
},
_this.axiosOptions
)
+2 -2
View File
@@ -385,7 +385,7 @@ describe("#Blockchain", () => {
})
it("should get information on an unspent tx", async () => {
sandbox.stub(axios, "get").resolves({ data: mockData.txOutUnspent })
sandbox.stub(axios, "post").resolves({ data: mockData.txOutUnspent })
const result = await bchjs.Blockchain.getTxOut(
"62a3ea958a463a372bc0caf2c374a7f60be9c624be63a0db8db78f05809df6d8",
@@ -404,7 +404,7 @@ describe("#Blockchain", () => {
})
it("should get information on a spent tx", async () => {
sandbox.stub(axios, "get").resolves({ data: null })
sandbox.stub(axios, "post").resolves({ data: null })
const result = await bchjs.Blockchain.getTxOut(
"87380e52d151856b23173d6d8a3db01b984c6b50f77ea045a5a1cf4f54497871",