Skip to content

Commit 661a759

Browse files
Merge pull request #258 from Permissionless-Software-Foundation/ct-unstable
feat(tx history): Updating to reflect changes in bch-api
2 parents eae7172 + ba915e8 commit 661a759

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/electrumx.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ class ElectrumX {
289289
* }
290290
*
291291
*/
292-
async transactions (address, usrObj = null) {
292+
async transactions (address, usrObj = null, allTxs = false) {
293293
try {
294294
// Handle single address.
295295
if (typeof address === 'string') {
296296
const response = await axios.get(
297-
`${this.restURL}electrumx/transactions/${address}`,
297+
`${this.restURL}electrumx/transactions/${address}/${allTxs}`,
298298
this.axiosOptions
299299
)
300300
return response.data
@@ -305,7 +305,8 @@ class ElectrumX {
305305
`${this.restURL}electrumx/transactions`,
306306
{
307307
addresses: address,
308-
usrObj // pass user data when making an internal call.
308+
usrObj, // pass user data when making an internal call.
309+
allTxs
309310
},
310311
this.axiosOptions
311312
)
@@ -315,6 +316,7 @@ class ElectrumX {
315316

316317
throw new Error('Input address must be a string or array of strings.')
317318
} catch (error) {
319+
// console.log('Error in transactions(): ', error)
318320
if (error.response && error.response.data) throw error.response.data
319321
else throw error
320322
}

test/integration/blockchain.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ describe('#blockchain', () => {
318318
it('should get info about the blockchain', async () => {
319319
const result = await bchjs.Blockchain.getBlockchainInfo()
320320

321-
console.log(`blockchain info: ${JSON.stringify(result, null, 2)}`)
321+
// console.log(`blockchain info: ${JSON.stringify(result, null, 2)}`)
322+
323+
assert.property(result, 'blocks')
322324
})
323325
})
324326
})

test/integration/control.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('#control', () => {
1515
describe('#getNetworkInfo', () => {
1616
it('should get info on the full node', async () => {
1717
const result = await bchjs.Control.getNetworkInfo()
18-
console.log(`result: ${JSON.stringify(result, null, 2)}`)
18+
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
1919

2020
assert.property(result, 'version')
2121
})

test/integration/rawtransaction.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ describe('#rawtransaction', () => {
204204
const result = await bchjs.RawTransactions.decodeScript(hex)
205205
// console.log(`result ${JSON.stringify(result, null, 2)}`)
206206

207-
assert.hasAllKeys(result, ['asm', 'type', 'p2sh'])
207+
assert.property(result, 'asm')
208+
assert.property(result, 'type')
209+
assert.property(result, 'p2sh')
208210
})
209211

210212
// CT 2/20/19 - Waiting for this PR to be merged complete the test:

0 commit comments

Comments
 (0)