mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-22 00:52:01 -07:00
Merge pull request #20 from christroutner/unstable
fix(gettxout): Uses new gettxout POST call
This commit is contained in:
+11
-2
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user